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

ÔõôдÕâ¸öSQLµÄÇóºÍÓï¾ä

select a.strno,a.strnam,b.sum(score) from
(select strno,strnam from name where strnam >2) a,
(select strno,sum(score) from score where strdate>'1-1ÔÂ-2009' group by strno having sum(score)>300) b
where a.strno=b.strno group by a.strno,a.strnam

±íAÖÐÊÇѧºÅºÍѧÃû£¬±íBÖÐÊÇѧºÅºÍ³É¼¨£¬ÎÒÏëÊä³öÒ»ÕŽñÄêѧÃû´óÓÚ2¸ö×ֵ쬳ɼ¨´óÓÚ300·ÖµÄ±í¸ñ¡£
µ«ÊÇÖ´Ðкó×ÜÊDZ¨´í£¬b.sum(score) ÊÇÎÞЧ±êʶ·û£¬Çë¸÷λָµãһϰÉ
sum([b].[score])

SQL code:
select a.strno,a.strnam,sum(b.score) from
(select strno,strnam from name where strnam >2) a,
(select strno,sum(score) from score where strdate>'1-1ÔÂ-2009' group by strno having sum(score)>300) b
where a.strno=b.strno group by a.strno,a.strnam


sum(b.score)Ó¦¸ÃÒ²¿ÉÒÔ,×ÜÖ®sumÊǺ¯Êý,Ó¦¸Ã·ÅÔÚÍâÃæ,Ò²¿ÉÒÔ¼ÓasÆð¸ö±ðÃû,±ÈÈç:sum(b.score) as bscore
ÒýÓÃ
SQL codeselect a.strno,a.strnam,sum(b.score)from
(select strno,strnamfrom namewhere strnam>2) a,
(select strno,sum(score)from scorewhere strdate>'1-1ÔÂ-2009'groupby strnohavingsum(score)>300) bwhere ¡­


SQL code:
select a.strno
, a.strnam
, sum(b.score)
from (sel


Ïà¹ØÎÊ´ð£º

ÇóSQL£¿

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

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

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

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

mysqlÓï¾äÓÅ»¯ÎÊÌâ ´ó¼Ò¸øÓÅ»¯¸öSQLÓï¾ä

SELECT a.tguildname ,SUM(a.ct) +  if (SUM(b.ct) IS NULL ,0,SUM(b.ct)) from (
SELECT  tg.tguildname,c.cid, (
cf.fbb + cf.fgjbb + cf.fjybb + cf.fqb + cf.fgjqb + cf.fjyqb + cf.fqib + cf. ......

´ÓORACLEµ½DB2µÄSQLÓï¾äÎÊÌâ

ÏÖÔÚÓÐÒ»ORACLEÖеÄSQLÓï¾ä£¬ÐèÒªÒÆÖ²µ½DB2ÖУ¬ÇëÎʸÃSQL¸ÄÈçºÎд
ORACLEÖУº
select floor(months_between(date1,date2)) from A  
date1,date2·Ö±ðΪ±íÖеÄÁ½¸ö×Ö¶Î £¬¶¼ÎªÈÕÆÚÐÍ 
DB2ÖÐÈçºÎʹÓÃÐ ......

sql´ïÈËÈ룬ÇóÒ»¾äsql£¬»òÕ߸ø³öÏàÓ¦µÄ½â¾ö·½°¸



±ía

Ïß·´úÂë Ïß·Ãû³Æ  Main_ID 
cir11    cirA        1
cir21    cirB        1
cir13    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ