日期:2014-05-18  浏览次数:20427 次

sql日期分组的
Ic20120410007 0 80 NULL admin 0 无 2012-04-07 00:00:00.000
Ic20120410008 0 30 NULL 0 2012-04-10 15:44:09.093
Ic20120410009 0 300 NULL NULL 0 NULL 2012-04-10 00:00:00.000
Ic20120410010 0 30 NULL 0 2012-04-10 15:56:08.720
Ic20120410011 0 50 NULL 0 2012-04-10 15:57:34.000


如图上表。
想根据天来统计出收入。
请教各位大神怎么写。谢谢了

------解决方案--------------------
SQL code

select sum(收入) ,convert(varchar(10),date,120) from tb group by convert(varchar(10),date,120)

------解决方案--------------------
SQL code

select 
convert(varchar(10),[时间字段]) as [时间],
sum([收入])
from [表名]
group by 
convert(varchar(10),[时间字段])