请教如何用SQL对每个小时内的数据进行统计?求高手指点,谢谢!

[复制链接]
查看11 | 回复2 | 2012-2-17 14:35:43 | 显示全部楼层 |阅读模式
select '2011-01-23 00:23:34' 日期 ,'a' 内容 into #temp unionselect '2011-01-23 00:35:31','a' unionselect '2011-01-23 02:44:34','a' unionselect '2011-01-23 02:52:12','b' unionselect '2011-01-23 04:23:34','c' unionselect '2011-01-23 04:11:03','d' unionselect '2011-01-23 04:05:34','c' unionselect '2011-01-23 05:23:21','b'selec...
回复

使用道具 举报

千问 | 2012-2-17 14:35:43 | 显示全部楼层
1)select 时间, count(号码) from AGROUP BY to_char(时间, 'yyyy-mm-dd hh')2) select 时间, count(distinct 号码) from AGROUP BY to_char(时间, 'yyyy-mm-dd hh')to_char(时间, 'yyyy-...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行