Why you want to use subqueries in that case? I thi...
# exposed
t
Why you want to use subqueries in that case? I think that simple inner join is enough:
Copy code
SELECT orig.*
FROM
  stoptimes orig
  INNER JOIN
  stoptimes dest
    ON orig.trip_id = dest.trip_id
WHERE orig.stop_sequence < dest.stop_sequence
      AND sorig.top_id = 'ORIGIN' AND dest.stop_id = 'DESTINATION';