I've got multiple hotels listed in different towns in different countries in
a mysql database. When someone visits one, I add one to a field called
'clicked'.
What I want to do is select out the most popular towns from the database
based on this number of clicks, but this query doesn't seem to work ..
SELECT towns, country
from hotels
GROUP BY town
ORDER BY clicked desc
LIMIT 0,5
I'm wondering whether I should have a nested select e.g.
SELECT *
from hotels
GROUP BY town
(SELECT * FROM hotels
ORDER BY clicked desc
)
This is just an example, I haven't figured out how to do it yet, just
wondering what methods are available to me.
Thanks
Comment