SQL statement to list and country countries in SQL
Let's say I have a some rows like this in a table:
SWEDEN MEXICO USA SWEDEN GERMANY RUSSIA MEXICO SWEDEN
Now I need to create a script to count the countries and list them like this:
Country Amount of countries SWEDEN 3 USA 1 MEXICO 2 RUSSIA 1 GERMANY 1
I'm stuck at:
SELECT Country FROM dbo.Customers
How do I only show them once and create a row and count them?
Thanks a lot..
SELECT Country, count(*) FROM dbo.Customers group by Country