-
Notifications
You must be signed in to change notification settings - Fork 0
/
route_links.sql
24 lines (22 loc) · 959 Bytes
/
route_links.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- To speed up the link finding we can order the dataset by stop ID, thus we only really have to ask, if it changes, we don't have to check for equality
-- In the same query we can also filter out any stops that only have a single route, because these stops make no connections between the routes
-- DAYTIME--------------------------------------------------------------------------------------------------------------
SELECT *
FROM routes_and_stops_daytime
WHERE stop_name IN (
SELECT stop_name
FROM routes_and_stops_daytime
GROUP BY stop_name
HAVING COUNT(stop_name) > 1
)
Order by stop_name;
-- NIGHTTIME------------------------------------------------------------------------------------------------------------
SELECT *
FROM routes_and_stops_nighttime
WHERE stop_name IN (
SELECT stop_name
FROM routes_and_stops_nighttime
GROUP BY stop_name
HAVING COUNT(stop_name) > 1
)
Order by stop_name;