简体   繁体   English

SQL-计算不同的次数?

[英]SQL - Count Distinct Occurrences?

I have a database like this: 我有一个这样的数据库:

Name, Day, Calls 名称,日期,电话

The day represents the date, the calls the number of phone calls they made. 日期代表日期,呼叫代表拨打的电话数量。 Is there an SQL syntax to return the total calls made on that day? 是否有SQL语法可返回当天的总调用次数? I'm presuming its COUNT DISTINCT but I cannot make it return the instance of eg two people, same day and the return should be the total for both. 我假设它的COUNT DISTINCT,但是我不能让它在同一天返回例如两个人的实例,并且返回值应该是两个人的总数。

SELECT Day, SUM(Calls) FROM table GROUP BY Day;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM