I have 2 tables. (hotels, locations).
I want to retrieve all the locations with a count of number of Hotels in that location.
Right now I have the following query:
SELECT locations.*,
COUNT(*) as no_of_hotels
FROM locations RIGHT JOIN hotels ON hotels.location_id = locations.id
GROUP BY locations.id
ORDER BY no_of_hotels DESC
The query works fine, but the problem is, It gives me only the locations with 1 or more hotels. I want to show all the locations (even though the location has no hotels).