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

44 lines
749 B
MySQL
Raw Normal View History

2016-05-31 16:13:17 +02:00
#Näherste / fernste Stationen
2016-06-02 06:39:58 +02:00
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
2016-10-03 16:16:09 +02:00
WHERE start != goal
2016-06-02 06:39:58 +02:00
ORDER BY length ASC;
2016-05-31 16:13:17 +02:00
# Suche nach Namen
SELECT *
2016-06-02 06:39:58 +02:00
FROM stationen
WHERE name LIKE "%Spitt%";
2016-05-31 16:13:17 +02:00
#gpsprune
SELECT
name,
length,
2016-06-02 06:39:58 +02:00
group_concat(id, ".gpx" SEPARATOR " ")
2016-05-31 16:13:17 +02:00
FROM connections
LEFT JOIN stationen ON (start = ref OR goal = ref)
WHERE ref = 906
2016-06-02 06:39:58 +02:00
ORDER BY length;
2016-05-31 16:13:17 +02:00
#(vermutlich) abgelegenste Stationen
SELECT *
FROM (SELECT
name,
2016-06-02 06:39:58 +02:00
length,
ref
2016-05-31 16:13:17 +02:00
FROM connections
LEFT JOIN stationen ON (start = ref OR goal = ref)
2016-10-03 16:16:09 +02:00
WHERE start != goal
2016-06-02 06:39:58 +02:00
ORDER BY length ASC) AS x
2016-05-31 16:13:17 +02:00
GROUP BY ref
2016-10-03 16:16:09 +02:00
ORDER BY length DESC