0

我有这张桌子:

呼叫

| Number | User_id | Duration | Date | Call_type |
  46534       2         65     1-1-13     5
  46535       3         55     1-1-13     4
  46537       1         47     1-2-13     5
  46538       7         87     3-4-13     7

我需要知道我有最少电话量的日期。

我怎样才能做到这一点?

4

2 回答 2

0
SELECT Top 1 WITH TIES Number
    COUNT(Number),
    MIN(Date)
FROM <tablename>
GROUP BY Number
ORDER BY COUNT(Number)
于 2013-07-16T21:07:46.900 回答
0

按日期分组并按计数排序,这会将调用次数最少的日期放在顶部:

select Date, count(*) as Calls
from CALLS
group by Date
order by count(*)
于 2013-07-16T21:15:25.483 回答