Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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£¿

´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e 
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......

pl/sqlµ¼ÈëÊý¾ÝÎÊÌâ

ÎÒEXCELÖÐÒ»¸öµ¥Ôª¸ñµÄÊý¾ÝÈç  "2009-01","8949-232"

½«Õâ¸öÊý¾ÝÕ³Ìùµ½PL/SQLÖеÄÒ»¸ö±íÖкó,Êý¾ÝÈ·ÊdzÉΪÁË 2009-01,8949-232 ,°ÑËùÓеÄ""¶¼Ã»ÁË,
ÈçºÎÅªÄØ?Çë´ó¼ÒÊÔ ......

SQLÓï¾äÎÊÌ⣬¸ßÊÖ°ïæ£¡£¡

½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿

21-30ÊÇʲôÒâ˼£¿×ֶεϰ¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......

ÊÕ¼¯ÁËһЩ΢ÈísqlÏà¹ØÈÏÖ¤¿¼ÊÔµÄÊÔÌ⼯ºÏ£¬·ÖÏíÒ»ÏÂ

»ìSQL°æÕâô¾ÃÁË£¬·ÖÏíÒ»µã×ÊÁÏ

sql serverµÄÏà¹ØÈÏÖ¤µÄÊÔÌ⼯ºÏ£¬°æÓÑÓл¹ÔÚѧУµÄ»°¾ÍÏÂÔØÏÂÀ´Óлú»á¿¼ÊÔһϣ¬±Ï¾¹350Ôª´ó¼Ò»¹ÊǸºµ£µÃÆðµÄ£¬½«À´±ÏÒµºóÒ²ÊÇÒ»¸öºÃÒ»µãµÄÖ¤ÊéÖ¤Ã÷

Èç¹û×¼±¸×¨×¢ÓÚÕâ ......

ÇósqlÓï¾ä

ɾ³ýnorthwindËùÓбíÖÐËùÓеÄÊý¾Ý
SQL code:
--ɾ³ýµ±Ç°Êý¾Ý¿âËùÓбíÖеÄÊý¾Ý
sp_MSforeachtable 'Delete from ?'
sp_MSforeachtable @command1="Delete from ? "
sp_MSforeachtable 'Truncate Ta ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ