Archived
1
0
Fork 0
This repository has been archived on 2024-06-28. You can view files and clone it, but cannot push or open issues or pull requests.
citybike/abfragen.sql
Lukas Winkler cbc87c7c82 Server
2016-10-03 16:16:09 +02:00

44 lines
No EOL
749 B
SQL

#Näherste / fernste Stationen
SELECT
id,
length,
s.name,
g.name
FROM connections
LEFT JOIN stationen AS s ON start = s.ref
LEFT JOIN stationen AS g ON goal = g.ref
WHERE start != goal
ORDER BY length ASC;
# Suche nach Namen
SELECT *
FROM stationen
WHERE name LIKE "%Spitt%";
#gpsprune
SELECT
name,
length,
group_concat(id, ".gpx" SEPARATOR " ")
FROM connections
LEFT JOIN stationen ON (start = ref OR goal = ref)
WHERE ref = 906
ORDER BY length;
#(vermutlich) abgelegenste Stationen
SELECT *
FROM (SELECT
name,
length,
ref
FROM connections
LEFT JOIN stationen ON (start = ref OR goal = ref)
WHERE start != goal
ORDER BY length ASC) AS x
GROUP BY ref
ORDER BY length DESC