I have table which basically describes a bus route. The table includes all the stops of a particular route.
This SQLFiddle shows an example. The data shows the flow in one direction, but a route can also be in the other direction.
I need to get a subset of this route (or all of it) depending on the start and end stations. So for example, I might have these:
A -> M (subset would be B -> L)
A -> K (subset would be B -> J)
C -> H (subset would be D -> G)
I -> M (subset would be J -> L)
However, if the direction is from, for example, H -> B, the subset would need to be G -> C.
The sequence column is for this purpose.
Is there a clean and easy way to do this using just SQL?
Aucun commentaire:
Enregistrer un commentaire