Advertisement
VladikOtez

3

Dec 29th, 2016
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.15 KB | None | 0 0
  1. SELECT origin, id,
  2.     (SELECT COUNT(*)
  3. FROM flights f
  4. WHERE f.id < flights.id
  5. AND f.origin=flights.origin) + 1
  6.  AS flight_sequence_number
  7. FROM flights;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement