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

sqlÓï¾äÇó½â - .NET¼¼Êõ / ASP.NET

Á½¸ö¶à±íÁª²é¶àÓï¾ä  
µÚÒ»¸ö±íÊÇ A BÁ½±í²é³ö
ID  
1
2
3
4
5
µÚ¶þ¸ö±íÉÌ A B CÈý±í²é³ö
3
4
5

ÎÊÈçºÎ°ÑʣϵÄ1£¬2Ò²²é³öÀ´
×îºÃÌù³öSQLÓï¾ä

union all ??
»òÕß×óÁ¬½Ó
SQL code:

select * from a left join b on a.id=b.id



°ï¶¥£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡

Éæ¼°Êý¾Ý¿â±íµÄÉè¼Æ£¬ÄÚÈÝÒÔ¼°Á¬½ÓÎÊÌ⣬ҲÐíÓÀÔ¶²é²»³öÀ´

±íµÄ¹Øϵ£¨¼ü»òË÷Òý£©¡­¡­

inµÚÒ»Õűí not inµÚ¶þÕűí

¼òµ¥À´Ëµ ±íA ID ±íB ID ±íC ID
select * from A£¬B
where A.ID = B.ID
µÃ³öIDΪ1£¬2£¬3£¬4£¬5ÌõÊý¾Ý

select * from A,B,C
where A.ID = B.ID
A.ID =C.ID
µÃ³öIDΪ1£¬2£¬3Êý¾Ý

ÏëÖªµÀÈçºÎ»ñµÃʣ϶à 4£¬5µÄÊý¾Ý

µÚÒ»±íÓï¾ä¼ÓÉÏ

and id not in(select id from µÚ¶þ±í...)

µÚÒ»±íÓï¾ä¼ÓÉÏ

and id not in(select id from µÚ¶þ±í...)

SQL code:
select * from A join B
on A.ID = B.ID left join c A.ID =C.ID




SQL code:

-- µÚÒ»Ìõselect µÃ³öIDΪ1£¬2£¬3£¬4£¬5ÌõÊý¾Ý
-- µÚ¶þÌõselect µÃ³öIDΪ3,4,5ÌõÊý¾Ý.
-- not in ,·µ»ØµÚÒ»Ìõselect½á¹ûÖв»ÔÚµÚ¶þÌõselect½á¹ûÖеÄ


Ïà¹ØÎÊ´ð£º

sqlССµÄÒÉÎÊ - .NET¼¼Êõ / C#

¿ÉÄÜÒòΪ¹¤×÷µÄÔ­Òò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......

ÇóÒ»sqlÓï¾ä - MS-SQL Server / ÒÉÄÑÎÊÌâ

ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄÇ°2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......

ÇóÒ»SQL - MS-SQL Server / »ù´¡Àà

tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......

js¿ØÖÆasp¿Õ¼ädropdownlist - .NET¼¼Êõ / ASP.NET

ÎÒÓÐÁ½¸ödropdownlist¶¼°óºÃÁËÖµ£¬ÏëÑ¡ÖÐÒ»¸ödropdownlistÖеÄÖµ£¬È»ºóÔÚÁíÒ»¸ödropdownlistÖÐÑ¡ÖÐÏàÓ¦µÄÒ»Ïî¡£
²»ÊÇ´Óа󶨵ڶþ¸ödropdownlist£¬ÊÇÔÚÒѾ­°óºÃµÄÖµµ±ÖÐÑ¡ÖÐÒ»¸ö¡£
ÎÒÏëÓÃjsд
ÇóÖú
Äã¿ÉÒÔ°Ñdrop ......

Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿ - MS-SQL Server / »ù´¡Àà

Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿
ÖÁÉٵø½¼Óµ½sqlserverÉÏ

¾ßÌåÔõôŪ°¡ ÎҵıÏÒµÉè¼ÆµÄÊý¾Ý¿âÊÇ´ÓÍøÉÏdownÏÂÀ´µÄ£¿£¿

Ä㻹²»ÈçÖ±½ÓÓÃsqlserverÄØ

º¯Êý¡¢´æ´¢¹ý³Ì¶¼µÃ¸ÄÁË¡£

sqlserverûÔõôÓùý¡£Ò²Ã»Óа²× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ