Created
November 22, 2012 16:28
-
-
Save engelmav/4131983 to your computer and use it in GitHub Desktop.
Buses to Port Authority
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
BusRoute.route_id | |
,bustrip.trip_id | |
,bustrip.trip_headsign | |
,BusStopTime.arrival_time | |
,busstopTime.stop_sequence | |
,busstop.stop_name | |
--,BusTripShape.shape_pt_sequence | |
FROM routes BusRoute | |
LEFT JOIN trips BusTrip | |
ON BusRoute.route_id = BusTrip.route_id | |
LEFT JOIN stop_times BusStopTime | |
ON BusTrip.trip_id = BusStopTime.trip_id | |
LEFT JOIN stops BusStop | |
ON BusStopTime.stop_id = BusStop.stop_id | |
WHERE | |
BusTrip.direction_id = '1' | |
and | |
bustrip.trip_id IN ( | |
SELECT | |
StopTime.trip_id | |
FROM stops StopName | |
LEFT JOIN stop_times StopTime | |
ON StopName.stop_id = StopTime.stop_id | |
WHERE | |
StopName.stop_name like '%AUTHORITY%') | |
AND | |
BusStopTime.arrival_time ~ '^05.*' | |
ORDER BY | |
BusRoute.route_id | |
,BusTrip.trip_id | |
,BusStopTime.stop_sequence | |
ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment