Skip to content

Instantly share code, notes, and snippets.

@rudmark
Created February 10, 2019 14:37
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 rudmark/4fa8a8b1695f5e1687abc39068edbda1 to your computer and use it in GitHub Desktop.
Save rudmark/4fa8a8b1695f5e1687abc39068edbda1 to your computer and use it in GitHub Desktop.
insert into shapes (shape_id, shape_pt_lat, shape_pt_lon, shape_pt_sequence)
select distinct stop_times.trip_id, stop_lat, stop_lon, stop_sequence
from
stop_times
inner join stops on stop_times.stop_id = stops.stop_id
inner join trips on stop_times.trip_id = trips.trip_id
where trips.shape_id not in (select shape_id from shapes)
order by stop_times.trip_id, stop_sequence;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment