Advertisement
Guest User

Untitled

a guest
Jun 1st, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. select * from trips where trip_id in
  2. (
  3. select substring_index(group_concat(t.trip_id order by NumStops desc), ',', 1) as tripID
  4. from trips t join
  5. (select st.trip_id, count(*) as NumStops
  6. from stoptimes st
  7. group by st.trip_id
  8. ) st
  9. on st.trip_id = t.trip_id
  10. group by t.route_id, t.direction_id
  11. )
  12.  
  13. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement