Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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