时间按天的group by问题
一组类似这样的数据
id num date
1 5 2007-7-17 09:08:11
2 6 2007-7-17 09:11:21
3 9 2007-7-17 09:18:11
4 7 2007-7-18 09:08:11
6 3 2007-7-18 09:38:13
想查询得到这样的效果
num date
20 2007-7-17 12:00:00
10 2007-7-18 ......
就是select num(num),date from table group by date...
怎么样才能让它按天进行分组呢,就是同一天的进行统计,不知有什么什么办法?
------解决方案--------------------select
num(num),to_char(date, 'YYYY-MM-DD ') as date
from
table
group by
to_char(date, 'YYYY-MM-DD ')
------解决方案--------------------select sum(num) num,to_char(date, 'yyyy-mm-dd ') date
from table
group by to_char(date, 'yyyy-mm-dd ');