请教各位,这个时间的问题怎么处理?

来源:百度知道 编辑:UC知道 时间:2024/05/28 05:19:55
我用sql语言,从一个销售纪录表中(其中有日期,销售金额,业务员),统计出每月每个业务员销售金额。但我们公司是每月(除6月,12月是最后一天做帐)25日,不知道该怎么写。求指点
我用
select sum(rJine),month([rDate]),ruser from baidu_records where year([rDate]) = '2007' and rZtype = '" & "销" & "' group by month([rDate]),ruser
不是我想要的显示结果.
我想如下显示:
月份 1 2 3 4 5.....
人员1 金额 金额....
人员2 金额 金额....

还有就是,每月25日关帐,月份怎处理啊?

谢谢啊!但是我在ASP中用,提示如下错误:
80004005

select ruser,
sum(case convert(char(6),[rDate],112) when '200701' then rJine else 0 end) as '200701qty',
sum(case convert(char(6),[rDate],112) when '200702' then rJine else 0 end) as '200702qty',
sum(case convert(char(6),[rDate],112) when '200703' then rJine else 0 end) as '200703qty',
sum(case convert(char(6),[rDate],112) when '200704' then rJine else 0 end) as '200704qty',
sum(case convert(char(6),[rDate],112) when '200705' then rJine else 0 end) as '200705qty',
sum(case convert(char(6),[rDate],112) when '200706' then rJine else 0 end) as '200706qty',
sum(case convert(char(6),[rDate],112) when '200707' then rJine else 0 end) as '200707qty',
sum(case convert(char(6),[rDate],112) when '200708' then rJine else 0 end) as '200708qty',
sum(case convert(char(6),[rDate],112) when '200709' then rJine else 0 end)