获取 SQL 中唯一列的计数 [英] Getting count of unique column in SQL
本文介绍了获取 SQL 中唯一列的计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮助我进行 Sql 查询,我可以在其中检索每个城市中存在的所有客户名称的计数.
Could some one help me out with an Sql query where I can retrieve the count of all the customers name present in each city .
您可以在此处找到示例表 该表的链接
You can find the example table here Link to the table
基本上我想得到一个结果,让我们知道每个城市有多少客户名称
Basically I want to get a result where we come know how many customer names are present in each city
如果您需要任何其他详细信息,请告诉我
Please let me know if you need any other details
推荐答案
应该这样做:
SELECT City, COUNT(CustomerID) as CustomersPerCity
FROM Customers
GROUP BY City
这篇关于获取 SQL 中唯一列的计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文