Hello,
I'm trying to setup a complicated query but I'm stuck and I am not sure if it is even possible to do it.
Here's the situation.
I have two tables: cities, routes.
'Cities' is basically a list of cities: paris, london, etc...
'Routes' has 3 columns: origin, destination, travelers.
Content for instance looks like:
Paris | London | 1512
Paris | Brussels | 789
Paris | Nice | 4856
etc...
I would like to setup a query that will return me for each city in my cities table, the most popular destination, based on the number of traveler.
I tried something like:
SELECT cities.origin, b.destination, b.travelers FROM cities, (SELECT * FROM routes WHERE routes.origin = cities.origin ORDER BY travelers DESC LIMIT) as b
But it doesnt work. Anybody would know how to achieve this?
Thank you in advance for any tip.