Skip to content

Instantly share code, notes, and snippets.

@plesner
Created February 8, 2017 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plesner/658aa7114641315a80c3e9a5e10ecff1 to your computer and use it in GitHub Desktop.
Save plesner/658aa7114641315a80c3e9a5e10ecff1 to your computer and use it in GitHub Desktop.
SELECT
stops.stop_name
, stop_times.departure_time_secs / 3600 AS departure_time_hours
, (stop_times.departure_time_secs / 60) - ((stop_times.departure_time_secs / 3600) * 60) AS departure_time_mins
, trips.trip_headsign
, routes.route_short_name
, calendars.monday
, calendars.tuesday
, calendars.wednesday
, calendars.thursday
, calendars.friday
, calendars.saturday
, calendars.sunday
FROM stops
JOIN stop_times ON stop_times.stop_id = stops.id
JOIN trips ON trips.id = stop_times.trip_id
JOIN routes ON routes.id = trips.route_id
JOIN calendars ON calendars.service_id = trips.service_id
WHERE
stops.stop_id LIKE '%38587'
AND calendars.wednesday = 1
ORDER BY stop_times.departure_time_secs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment