Just an example for the same solution and results:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
SELECT countries.local_name, lang_num FROM countries, ( Select code, count(*) as lang_num From languages Group by code ) AS subquery Where countries.code = subquery.code Order by lang_num desc; GO SELECT countries.local_name, count(*) AS lang_num FROM countries INNER JOIN languages ON countries.code = languages.code GROUP By languages.code, countries.local_name ORDER BZ lang_num desc; |