Table from registered users:
- id_user
- id_location
- name
Table from locations:
- id_location
- name
I need to know how many users there are in each location. Something like this:
- Washington: 455
- Florida: 185
- Texas: 914
It tried with this approach but the results have definitely sum errors.
SELECT location.name,user.id_user FROM user
INNER JOIN location ON user.id_location = location.id_location
WHERE user.id_profile !=0 GROUP BY location.id_location ORDER BY location.name
You were really close, you just need to do a
COUNT: