统计最多次数的一天
有表结构如下:
ID IPID LogAddTime
1 1 2007-3-29 9:41:00
2 1 2007-1-29 10:16:00
3 1 2007-3-28 10:16:00
4 4 2007-2-28 10:17:00
5 1 2006-3-27 10:17:00
6 3 2007-3-29 10:17:00
7 1 2007-3-29 10:17:00
8 3 2007-1-29 10:17:00
9 1 2007-3-29 10:17:00
10 8 2007-3-28 10:25:00
11 1 2007-1-29 10:25:00
12 1 2006-3-25 10:26:00
13 8 2007-3-28 10:26:00
14 2 2007-3-29 10:58:00
15 2 2007-2-9 10:58:00
16 2 2007-3-29 10:58:00
17 10 2007-3-29 10:58:00
18 2 2007-3-29 10:58:00
19 9 2007-3-29 10:58:00
20 2 2007-3-29 10:58:00
想取出IPID数量最多的一天?
sql怎么写 谢谢高手
------解决方案--------------------IPID是个数还是一个id?
重复的算不算?
select top 1 Year(LogAddTime),Month(LogAddTime),
Day(LogAddTime),COUNT( DISTINCT IPID)
from 表
group by Year(LogAddTime),Month(LogAddTime),
Day(LogAddTime)
order by COUNT( DISTINCT IPID) desc
------解决方案--------------------IPID是id