Created
April 24, 2018 21:38
-
-
Save denysvitali/d2772a8a1440d3678c78378daeb1a2ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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 trip.uid FROM ( | |
SELECT DISTINCT st.trip_id, st.feed_id FROM stop_time as st | |
INNER JOIN (SELECT s.uid, s.id, s.feed_id FROM stop as s | |
WHERE | |
ST_Within( | |
s.position::geometry, | |
ST_MakeEnvelope( | |
5.9559,45.818, 10.4921, 47.8084, | |
4326) | |
) | |
) as sir ON sir.id = st.stop_id AND sir.feed_id = st.feed_id | |
) as sst | |
INNER JOIN trip ON sst.trip_id = trip.trip_id AND sst.feed_id = trip.feed_id | |
WHERE trip.feed_id = sst.feed_id AND trip.trip_id = sst.trip_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment