SQL问题?
[code=select a.fyear,b.fname,sum(a.fendbal) as fendbal,
'1月'=case when fperiod=1 then sum(a.fendbal) else 0 end ,
'2月'=case when fperiod=2 then sum(a.fendbal) else 0 end ,
'3月'=case when fperiod=3 then sum(a.fendbal) else 0 end ,
'4月'=case when fperiod=4 then sum(a.fendbal) else 0 end ,
'5月'=case when fperiod=5 then sum(a.fendbal) else 0 end ,
'6月'=case when fperiod=6 then sum(a.fendbal) else 0 end ,
'7月'=case when fperiod=7 then sum(a.fendbal) else 0 end ,
'8月'=case when fperiod=8 then sum(a.fendbal) else 0 end ,
'9月'=case when fperiod=9 then sum(a.fendbal) else 0 end ,
'10月'=case when fperiod=10 then sum(a.fendbal) else 0 end ,
'11月'=case when fperiod=11 then sum(a.fendbal) else 0 end ,
'12月'=case when fperiod=12 then sum(a.fendbal) else 0 end
from openrowset('sqloledb','192.168.12.101';'sa';'',ais20080707094757.dbo.icinvbal) as a
inner join openrowset('sqloledb','192.168.12.101';'sa';'',ais20080707094757.dbo.t_stock) as b
on a.fstockid=b.fitemid
group by a.fyear,a.fperiod,b.fname
with rollup
][/2008 钢材库 3295826.03 .00 .00 .00 3295826.03 .00 .00 .00 .00 .00 .00 .00 .00
2008 NULL 3295826.03 .00 .00 .00 3295826.03 .00 .00 .00 .00 .00 .00 .00 .00
2008 半成品库 17935
相关问答:
本人c#新手 可是要求要用c# ,sql2000开发c/s的工作流,一头雾水,请大家帮忙帮忙,给点思路,说的约具体越好,我也好往那个方面去学习
http://www.hxzi.com/view/61402.html
B/S版的,基本思想应该差不多的。。 ......
我EXCEL中一个单元格的数据如 "2009-01","8949-232"
将这个数据粘贴到PL/SQL中的一个表中后,数据确是成为了 2009-01,8949-232 ,把所有的""都没了,
如何弄呢?请大家试 ......
表a(没有主键)
id name age
----------- ---------- -----------
1 chenqin& ......
根据班级分组,统计平均分和不及格的个数.
我的想法是这样的.
Select avg(testScore) as 平均分, count(testScore <600) as 不及格数 , from [Person] Group by Class
但是count(testScore <60 ......
create table jskb(
编号 int identity(1,1) primary key not null,
姓名 varchar(20) not null,
性别 char(1) not null ,
授课名 varchar(10) not null,
教室号 int(10)
)
错哪呢?
cre ......