group by加时间条件的一个语句

commemoration 2010-09-01 02:33:14
select Count(*) as Count,ID from Tables group by ID 


以上这条语句中我想加个时间段的选择,时间条件为: and Date<='2010-08-07 00:00:00' and Date>='2010-08-08 00:00:00' ,请问能加吗?如过能的话怎么加?谢谢!
...全文
271 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hao1hao2hao3 2010-09-01
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 haiwer 的回复:]
你的条件写错了


SQL code
select Count(*) as Count,ID from Tables
where Date>='2010-08-07 00:00:00' and Date<='2010-08-08 00:00:00'
group by ID
[/Quote]

海哥,太细心了。这都被你发现了。
Q1277516668 2010-09-01
  • 打赏
  • 举报
回复
group by
commemoration 2010-09-01
  • 打赏
  • 举报
回复
原来那么简单啊,搞迷糊了 呵呵 谢谢!
昵称被占用了 2010-09-01
  • 打赏
  • 举报
回复
你的条件写错了

select Count(*) as Count,ID from Tables 
where Date>='2010-08-07 00:00:00' and Date<='2010-08-08 00:00:00'
group by ID
cjzm83 2010-09-01
  • 打赏
  • 举报
回复
select Count(*) as Count,ID from Tables
where Date<='2010-08-07 00:00:00' and Date>='2010-08-08 00:00:00'
group by ID
昵称被占用了 2010-09-01
  • 打赏
  • 举报
回复
select Count(*) as Count,ID from Tables 
where Date<='2010-08-07 00:00:00' and Date>='2010-08-08 00:00:00'
group by ID

34,592

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧