Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎÊ´ð£º

Á½¸öµ¼¹¹sql serverÊý¾Ý¿â,Êý¾Ýµ¼Èëµ¼³öÎÊÌâ

ÏÖÔÚÓÐÁ½¸öÒì¹¹µÄsql serverÊý¾Ý¿â,ÎÒÏ뽫µÚÒ»¸ö±íÖеÄÊý¾Ýµ¼Èëµ½µÚ¶þ¸ö±íÖÐ,×Ô¼ºÖ¸¶¨µ¼ÈëÊý¾ÝµÄ×Ö¶Î,ÈçºÎµ¼ÈëÊý¾ÝÄØ,´ó¼ÒÌÖÂÛÒ»ÏÂ?
dts¹¤¾ß

µ¼Èëµ¼³ö¹¤¾ß.

DD

¹þ¹þ£¬¹À¼ÆÕâλÊǵØQIOU¶¼Êܲ»Á˵Ä

Ö±½ÓÐ ......

sql²éѯÒÉÎÊ

±íÖа´datadate,tradeidΪÖ÷¼ü£¬Ò²¾ÍÊÇ˵tradeid»áÖØ¸´³öÏÖÔÚ²»Í¬ÌìÖУ¬Í¬Ò»ÌìµÄtradeidÊDz»Í¬µÄ¡£ÏÖÔÚÎÒÏ£Íûȡһ¶Îʱ¼ä·¶Î§ÄÚ²»Öظ´µÄtradeid£¬ÇÒֻҪÿ¸ötradeidµÄ×îºóÒ»´Î³öÏÖµÄÄÇÌõ¡£sqlÓï¾ä¸ÃÔõôд

£º ......

ÀÏÎÊÌâ ͨ¹ýSQLÓï¾äÈçºÎɾ³ý±íÖеÄÖØ¸´¼Ç¼£¿

±ía(ûÓÐÖ÷¼ü)
id          name      age       
----------- ---------- -----------
1          chenqin& ......

sql ÎÊÌâ

DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)

string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime ......

SQLÓï¾äÔõôд£¿

ÎÒÓÐÒ»Õűí Create table abc (ID int primary key, A varchar(20), B varchar(20)); Êý¾Ý¿âÖÐAºÍB×ֶβ»ÄÜÖØ¸´£¬Ò²¾ÍÊDZÈÈçÎÒ²åÈëÒ»Ìõ¼Ç¼ £ºinsert into abc(ID, A, B) values(1, abc123, abc456);
ÎÒÔÚ²åÈëµÚ¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ