I have data corpus like:
DeviceID Country
id_1 country_1
id_2 country_1
id_3 country_1
id_4 country_2
id_5 country_2
id_6 country_2
and I want result like:
DistCountries DeviceCount
country_1 3
country_2 3
I have used following query to extract distinct country list:
SELECT DISTINCT(Country) as DistCountries FROM devices;
But, I don't know what can be done to get the required results. Can this be done instead of loops? Any help would be appreciated.