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


Ïà¹ØÎĵµ£º

Excelµ¼ÈëSQLÊý¾Ý¿â³öÏÖµÄÎÊÌ⡾½â¾ö¡¿

¡¾ÎÊÌâÒ»
¡¿£ºÒѾܾø¶Ô OLE DB Ìṩ³ÌÐò 'MICROSOFT.JET.OLEDB.4.0' µÄÌØÊâ·ÃÎÊ¡£±ØÐëͨ¹ýÁ´½Ó·þÎñÆ÷À´·ÃÎÊ´ËÌṩ³ÌÐò¡£
¡¾·ÖÎö
¡¿£ºÕâÊÇÒòΪÄúµ±Ç°ÓÃÀ´·ÃÎÊÊý¾Ý¿âµÄµÇ¼µÄȨÏÞ²»¹»£¨È¨ÏÞÌ«µÍ£©¡£
¡¾½â¾ö
¡¿£ºÒªÃ´Äú»¹ÓÃsaµÇ¼£¬ÒªÃ´Ð޸ĵ±Ç°µÇ¼µÄȨÏÞ£¬²½ÖèÈçÏ£ºÆóÒµ¹ÜÀíÆ÷→°²È«ÐÔ→µÇ¼→ÕÒµ½ÄãËùÓõ ......

SQL ServerÖб¸·ÝÎļþÀÛ»ýµÄÎÊÌâ

Äã´´½¨µÄÿһ¸ö±¸·Ý¶¼ÊÇÒ»¸ö±¸·ÝÉ豸£¬¹ØÓÚËüµÄϸ½ÚÐÅÏ¢¶¼´æ´¢ÔÚmsdb..backupset±íÖС£Ò»¸ö±¸·ÝÉ豸¿ÉÒÔ±»´æ´¢ÔÚµ¥Ò»Îļþ£¬»òÊǶà¸öÎļþÖС£Í¬Ñù£¬Ò»¸öÎļþÒ²¿ÉÒÔ´æ´¢¶à¸ö±¸·ÝÉ豸¡£
ËùÒÔ£¬¼ÙÈçÄãÿ´Î±¸·Ý¶¼Ê¹ÓÃÏàͬµÄÎļþÃû£¬Îļþ¾Í»áÒ»Ö±Ôö³¤¡£Ò»¸öÆÕ±éµÄÎó½âÊÇ£ºÈç¹ûÄãÿ´ÎʹÓÃÏàͬµÄÎļþÃû£¬ÄǾɵı¸·ÝÉ豸¾Í»á±»¸²¸Ç¡ ......

ʹÓÃHibernate+MySql+native SQLµÄBUG,ÒÔ¼°½â¾ö°ì·¨

±¾À´ÊÇmssql+hibernate+native SQL Ó¦ÓõĺܺÍг
µ«Êǵ½ÁË°Ñmssql»»³Émysql£¬¾Í³öÁË´í(ͬÑùµÄÊý¾Ý½á¹¹ºÍÊý¾Ý)¡£
²éѯ·½·¨ÊÇ£º
String sql =
"select id XXX_ID from t_tab";
List<Map> list = session.createSQLQuery(sql)
.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP)
.list();
´í ......

SQL Server 2005 (MSSQLSERVER) ·þÎñ²»ÄÜÆô¶¯

SQL Server 2005 (MSSQLSERVER) ·þÎñ²»ÄÜÆô¶¯
Ô­Òò:VIAЭÒ锸øÆôÓÃÁË£¬Í£ÓÓVIAЭÒé”ÎÊÌâ½â¾ö¡£
"VIAЭÒé"Í£Ó÷½·¨£º¿ªÊ¼->³ÌÐò->Microsoft SQL Server 2005->ÅäÖù¤¾ß->SQL Server Configuration Manager ->´ò¿ªºóÕÒµ½"SQL Server 2005 ÍøÂçÅäÖÃ"->MSSQLSERVER ÊôÐÔµÄЭÒé &nb ......

ÈçºÎ¼ì²éSQL Server×èÈû

--²éѯӦÓóÌÐòµÄµÈ´ý
SELECT TOP 10
wait_type,waiting_tasks_count AS tasks,
wait_time_ms,max_wait_time_ms AS max_wait,
signal_wait_time_ms AS signal
from sys.dm_os_wait_stats
ORDER BY wait_time_ms DESC
--²éѯÔÚÈÎһʱ¿ÌËùÓÐÊÚȨ¸øµ±Ç°Ö´ÐÐÊÂÎñ»òµ±Ç°Ö´ÐÐÊÂÎñµÈ´ýµÄËø
SELECT
request_session_id A ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ