I have a table that has 3 columns representing the stops in a bus route.
ID
stop_name
stop_order
I am wanting to return a list of stops starting with the current stop (which I know). So if the current stop is stop number 5 then what is returned will be as follows:
stop_order
5
6
7
8
1
2
3
4
I tried:
Select * from routes where stop_order >= 3 and route = 'Red'
Union
Select * from routes where stop_order < 3 and route = 'Red
and it works if the data was entered into the table in the order of the stops. If it wasn't then it returns the data in the order it was entered.