could you please help me with this? I have the following query which returns country name, number of records for each country, and total number of countries . How can I get it to also return a column for % of each country with respect to total number. Ideal output would be something like.
USA, 25, 100, 25% ... UK, 28, 100, 28% ... etc...
SELECT Country, COUNT(Country) AS number, (SELECT COUNT(Country)
FROM[Customers]) AS total FROM [Customers]
GROUP BY Country ORDER BY number DESC
I have tried number/total AS percent
but it didn't work. Obviously I am doing something wrong.
I want to be able to filter countries that are above certain percentage say 20%.
Thanks!