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

sqlµÄ INNER JOIN, left join,right joinÓï·¨

inner join(µÈÖµÁ¬½Ó) Ö»·µ»ØÁ½¸ö±íÖÐÁª½á×Ö¶ÎÏàµÈµÄÐÐ
left join(×óÁª½Ó) ·µ»Ø°üÀ¨×ó±íÖеÄËùÓмǼºÍÓÒ±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
right join(ÓÒÁª½Ó) ·µ»Ø°üÀ¨ÓÒ±íÖеÄËùÓмǼºÍ×ó±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
INNER JOIN Óï·¨£º
INNER JOIN Á¬½ÓÁ½¸öÊý¾Ý±íµÄÓ÷¨£º
SELECT * from ±í1 INNER JOIN ±í2 ON ±í1.×ֶκÅ=±í2.×ֶκÅ
INNER JOIN Á¬½ÓÈý¸öÊý¾Ý±íµÄÓ÷¨£º
SELECT * from (±í1 INNER JOIN ±í2 ON ±í1.×ֶκÅ=±í2.×ֶκÅ) INNER JOIN ±í3 ON ±í1.×ֶκÅ=±í3.×ֶκÅ
INNER JOIN Á¬½ÓËĸöÊý¾Ý±íµÄÓ÷¨£º
SELECT * from ((±í1 INNER JOIN ±í2 ON ±í1.×ֶκÅ=±í2.×ֶκÅ) INNER JOIN ±í3 ON ±í1.×ֶκÅ=±í3.×ֶκÅ) INNER JOIN ±í4 ON Member.×ֶκÅ=±í4.×ֶκÅ
INNER JOIN Á¬½ÓÎå¸öÊý¾Ý±íµÄÓ÷¨£º
SELECT * from (((±í1 INNER JOIN ±í2 ON ±í1.×ֶκÅ=±í2.×ֶκÅ) INNER JOIN ±í3 ON ±í1.×ֶκÅ=±í3.×ֶκÅ) INNER JOIN ±í4 ON Member.×ֶκÅ=±í4.×ֶκÅ) INNER JOIN ±í5 ON Member.×ֶκÅ=±í5.×ֶκÅ
Á¬½ÓÁù¸öÊý¾Ý±íµÄÓ÷¨£ºÂÔ£¬ÓëÉÏÊöÁª½Ó·½·¨ÀàËÆ£¬´ó¼Ò¾ÙÒ»·´Èý°É£º£©
×¢ÒâÊÂÏ
ÔÚÊäÈë×Öĸ¹ý³ÌÖУ¬Ò»¶¨ÒªÓÃÓ¢ÎÄ°ë½Ç±êµã·ûºÅ£¬µ¥´ÊÖ®¼äÁôÒ»°ë½Ç¿Õ¸ñ£»
ÔÚ½¨Á¢Êý¾Ý±íʱ£¬Èç¹ûÒ»¸ö±íÓë¶à¸ö±íÁª½Ó£¬ÄÇôÕâÒ»¸ö±íÖеÄ×ֶαØÐëÊÇ“Êý×Ö”Êý¾ÝÀàÐÍ£¬¶ø¶à¸ö±íÖеÄÏàͬ×ֶαØÐëÊÇÖ÷¼ü£¬¶øÇÒÊÇ“×Ô¶¯±àºÅ”Êý¾ÝÀàÐÍ¡£·ñÔò£¬ºÜÄÑÁª½Ó³É¹¦¡£
´úÂëǶÌ׿ìËÙ·½·¨£ºÈ磬ÏëÁ¬½ÓÎå¸ö±í£¬ÔòÖ»ÒªÔÚÁ¬½ÓËĸö±íµÄ´úÂëÉϼÓÒ»¸öÇ°ºóÀ¨ºÅ£¨Ç°À¨ºÅ¼ÓÔÚfromµÄºóÃ棬ºóÀ¨ºÅ¼ÓÔÚ´úÂëµÄĩβ¼´¿É£©£¬È»ºóÔÚºóÀ¨ºÅºóÃæ¼ÌÐøÌí¼Ó“INNER JOIN ±íÃûX ON ±í1.×ֶκÅ=±íX.×ֶκŔ´úÂë¼´¿É£¬ÕâÑù¾Í¿ÉÒÔÎÞÏÞÁª½ÓÊý¾Ý±íÁË£º£©
inner join on, left join on, right join on½²½â(תÔØ)
1.ÀíÂÛ
Ö»ÒªÁ½¸ö±íµÄ¹«¹²×Ö¶ÎÓÐÆ¥ÅäÖµ£¬¾Í½«ÕâÁ½¸ö±íÖеļǼ×éºÏÆðÀ´¡£
¸öÈËÀí½â£ºÒÔÒ»¸ö¹²Í¬µÄ×Ö¶ÎÇóÁ½¸ö±íÖзûºÏÒªÇóµÄ½»¼¯£¬²¢½«Ã¿¸ö±í·ûºÏÒªÇóµÄ¼Ç¼ÒÔ¹²Í¬µÄ×Ö¶ÎΪǣÒýºÏ²¢ÆðÀ´¡£
Óï·¨
from table1 INNER JOIN table2 ON table1 . field1 compopr table2 . field2
INNER JOIN ²Ù×÷°üº¬ÒÔϲ¿·Ö£º
²¿·Ö
˵Ã÷
table1, table2
Òª×éºÏÆäÖеļǼµÄ±íµÄÃû³Æ¡£
field1£¬field2
ÒªÁª½ÓµÄ×ֶεÄÃû³Æ¡£Èç¹ûËüÃDz»ÊÇÊý×Ö£¬ÔòÕâЩ×ֶεÄÊý¾ÝÀàÐͱØÐëÏàͬ£¬²¢ÇÒ°üº¬Í¬ÀàÊý¾Ý£¬µ«ÊÇ£¬ËüÃDz»±Ø¾ßÓÐÏàͬµÄÃû³Æ¡£
compopr
ÈκιØϵ±È½ÏÔËËã·û£º&l


Ïà¹ØÎĵµ£º

SQL Server 2008ÖеıíÖµÐͲÎÊý

SQL Server 2008ÖеıíÖµÐͲÎÊý
×÷ÕߣºAl Tenhundfeld   ÒëÕß Õź£Áú¡¡
    ±íÖµÐͲÎÊý£¨Table-valued parameters£©ÊÇSQL Server 2008ÖÐÒýÈëµÄÒ»ÖÖÐÂÌØÐÔ£¬ËüÌṩÁËÒ»ÖÖÄÚÖõķ½Ê½£¬Èÿͻ§¶ËÓ¦ÓÿÉÒÔֻͨ¹ýµ¥¶ÀµÄÒ»Ìõ²Î»¯ÊýSQLÓï¾ä£¬¾Í¿ÉÒÔÏòSQL Server·¢ËͶàÐÐÊý¾Ý¡£
    ±íÖ ......

PHP SQL ×¢Èë¹¥»÷µÄ¼¼ÊõʵÏÖÒÔ¼°Ô¤·À°ì·¨

¡¡×î½üÔÚÕÛÌÚ PHP + MYSQL
µÄ±à³Ì¡£Á˽âÁËһЩ PHP SQL ×¢Èë¹¥»÷
µÄ֪ʶ£¬ÓÚÊÇдÁËÕâƪÎÄÕ¡¡http://www.xiaohui.com/weekly/20070314.htm£¬×ܽáһϾ­Ñé¡£ÔÚÎÒ¿´À´£¬Òý·¢ SQL ×¢Èë¹¥»÷
µÄÖ÷ÒªÔ­Òò£¬ÊÇÒòΪÒÔÏÂÁ½µãÔ­Òò£º
¡¡¡¡1. php ÅäÖÃÎļþ php.ini ÖÐµÄ magic_quotes_gpc
Ñ¡ÏîûÓдò¿ª£¬±»ÖÃΪ off
¡¡¡¡2. ¿ª·¢ ......

SQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(2)

ÎÄÕµ¼º½ SQL Server 2005 ѧϰ±Ê¼ÇϵÁÐÎÄÕµ¼º½
     ÔÚSQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(1) ÀïÎÒÃÇ˵Á˹ØÓÚPath£¬RawºÍAutoģʽµÄÓ÷¨£¬ÆäʵÀïÃæ²»½ö½ö ÊÇÕâЩ¼òµ¥µÄ²Ù×÷£¬»¹ÓÐһЩÆäËüµÄÌØÐÔ£¬±ÈÈç˵Type»òOpenXml·½·¨£¬sp_xml_preparedocument´æ´¢¹ý³Ì µÈÕâЩÔö¼ÓµÄ¶«¶«£¬ÎÒÃÇÀ´Ò» ......

SQL Server 2005 ÖеÄRow_Number()º¯Êý

±¾ÎÄÀ´×Ô£ºhttp://www.cnblogs.com/digjim/archive/2006/09/20/509344.html
 ÎÒÃÇÖªµÀ£¬SQL Server 2005ºÍSQL Server 2000 Ïà±È½Ï£¬SQL Server 2005ÓкܶàÐÂÌØÐÔ¡£ÕâƪÎÄÕÂÎÒÃÇÒªÌÖÂÛÆäÖеÄÒ»¸öк¯ÊýRow_Number()¡£Êý¾Ý¿â¹ÜÀíÔ±ºÍ¿ª·¢ÕßÒѾ­ÆÚ´ýÕâ¸öº¯ÊýºÜ¾ÃÁË£¬ÏÖÔÚÖÕÓڵȵ½ÁË£¡
 Í¨³££¬¿ª·¢Õߺ͹ÜÀíÔ±ÔÚÒ»¸ö ......

SQL ×Ö·û´®º¯ÊýС×ܽá

Á·ÊÖ£¬Ã¿Ìì²é¿´±ðÈ˵Ķ«Î÷£¬²»Èç×Ô¼º×ܽáºÃ
1:replace º¯Êý
µÚÒ»¸ö²ÎÊýÄãµÄ×Ö·û´®£¬µÚ¶þ¸ö²ÎÊýÄãÏëÌæ»»µÄ²¿·Ö£¬µÚÈý¸ö²ÎÊýÄãÒªÌæ»»³Éʲô
select replace('lihan','a','b')
                      &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ