http://http://topic.csdn.net/u/20120223/09/2a1f4502-dd66-424b-9898-a9d71a61f55e.html?64999
测试了一下没有用啊
得不到下面的表
------解决方案--------------------
- SQL code
select 员工号,sum(数量) as 数量, convert(varchar(10),日期,120) as 日期from tbgroup by 员工号,convert(varchar(10),日期,120)
------解决方案--------------------
http://topic.csdn.net/u/20120223/09/2a1f4502-dd66-424b-9898-a9d71a61f55e.html?64999
测试没有问题呀
------解决方案--------------------
- SQL code
create table tb (员工号 varchar(10), 数量 int,日期 datetime)insert tb select '1001','2','2009/9/1' union allselect '1002','3','2009/9/1' union allselect '1001','4','2009/9/1' union allselect '1002','2','2009/9/1' union allselect '1001','2','2009/9/2' union allselect '1002','3','2009/9/2' union allselect '1001','4','2009/9/2' union allselect '1002','2','2009/9/2'goselect 员工号 , sum(数量) 数量 , convert(varchar(10),日期,120) 日期from tbgroup by 员工号 , convert(varchar(10),日期,120)drop table tb/*员工号 数量 日期 ---------- ----------- ---------- 1001 6 2009-09-011002 5 2009-09-011001 6 2009-09-021002 5 2009-09-02(所影响的行数为 4 行)*/