I'm trying to build a query which will get me a field which is mutual for two rows. This is the data I have presented in Excel (it's the same in the SQL table):
We have two dropdowns, one for start and end point of the trip. Once the user will select the start point, the dropdown is filtered to get only the destinations which are possible from that starting point.
Now, based on the screenshot, if the user selects 'Mazarron' for starting point and 'Albacete' for end point I want to get the name of the lines which offer that option, based on the start and end point, and that would mean also that the Stop Order of the end point will need to be larger from the Stop Order value of the start point. In our case I should get 'Aguilas-Madrid' and 'Puerto de Mazarron-Madrid' but not 'Puerto de Mazarron-Madrid' line.
What can be the best approach to filter those results when I'll use two parameters or @start and @end point of the trip?