How to select values in MySQL table by the count of a field in the same table ?
Example:
Table users has id, name, password, country
I want to select all ids of only top 3 countries with highest users count to look like this:
country, id
When I try this
WHERE country IN (SELECT country FROM USERS GROUP BY country ORDER BY COUNT(id) DESC LIMIT 3)
I get This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
Server version: 5.6.33-79.0 Percona Server