我有一个表,数据为 日期 姓名 费用1 费用 2
2008-3-10 12:00:00 1 10 20
2008-3-10 12:01:00 2 10 20
2008-3-10 12:05:00 3 10 20
2008-3-11 12:01:00 4 10 20
2008-3-11 12:56:00 5 10 20
2008-3-13 12:00:00 6 10 20
2008-3-16 12:00:00 7 10 20想得到的结果是
日期 人次 费用1 费用 2
2008-3-10 3 30 60
2008-3-11 2 20 40
2008-3-13 1 10 20
2008-3-16 1 10 20语句应该怎么写?谢谢
2008-3-10 12:00:00 1 10 20
2008-3-10 12:01:00 2 10 20
2008-3-10 12:05:00 3 10 20
2008-3-11 12:01:00 4 10 20
2008-3-11 12:56:00 5 10 20
2008-3-13 12:00:00 6 10 20
2008-3-16 12:00:00 7 10 20想得到的结果是
日期 人次 费用1 费用 2
2008-3-10 3 30 60
2008-3-11 2 20 40
2008-3-13 1 10 20
2008-3-16 1 10 20语句应该怎么写?谢谢
from tb
group by convert(char(10),日期,120)
from tb
group by convert(char(10),日期,120)--或select convert(char(10),日期,120) as 日期,sum(1) as 人次,sum(费用1) as 费用1,sum(费用2) as 费用2
from tb
group by convert(char(10),日期,120)
from tb
group by convert(char(10),日期,120)