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..

Answers


try

SELECT Country, count(*)
FROM dbo.Customers
group by Country

Need Your Help

User profile status in CSS

html css styles

I am trying to implement a user profile status bar in my webpage. For this I have done the following:

How to get a page number by row id in jqGrid

javascript jqgrid pager

After loading a JSON (using loadonce: true) I get a paged grid.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.