尊龙凯时人生就是搏

mysqlÖÐunionʲôÒâ˼

mysql ÖÐµÄ union ÊÇÒ»ÖÖÍŽá²Ù×÷·û£¬ÓÃÓÚδÀ´×Ô²î±ð±í»òÅÌÎʵĶà¸öЧ¹û¼¯×éºÏΪһ¸öÎÞÖظ´ÐеÄÐÂЧ¹û¼¯£¬ÐÂЧ¹û¼¯ÖеÄÁбØÐè¾ßÓÐÏàͬµÄÊý¾ÝÀàÐÍÎÂ˳Ðò£¬µ« union ²»Ö§³Ö¾ÛºÏº¯ÊýºÍ order by ×Ӿ䡣

ʲôÊÇ MySQL ÖÐµÄ UNION£¿

UNION ÔÚ MySQL ÖÐÊÇÒ»ÖÖÍŽá²Ù×÷·û£¬ÓÃÓÚ×éºÏÀ´×Ô²î±ð±í»òÅÌÎʵĶà¸öЧ¹û¼¯ÎªÒ»¸öЧ¹û¼¯¡£

ÔõÑùʹÓà UNION£¿

UNION Óï·¨ÈçÏ£º

SELECT ÁÐÃû, ÁÐÃû, ...
FROM ±íÃû
UNION
SELECT ÁÐÃû, ÁÐÃû, ...
FROM ±íÃû

µÇ¼ºó¸´ÖÆ

ʾÀý£º

-- ½«±í A ºÍ B ÖÐµÄ name ÁÐ×éºÏΪһ¸öЧ¹û¼¯
SELECT name
FROM A
UNION
SELECT name
FROM B

µÇ¼ºó¸´ÖÆ

UNION µÄÌص㣺

Ч¹û¼¯Öв»ÔÊÐíÖظ´µÄÐС£

Ч¹û¼¯ÖеÄÁбØÐè¾ßÓÐÏàͬµÄÊý¾ÝÀàÐÍÎÂ˳Ðò¡£

UNION µÄÏÞÖÆ£º

UNION ²»Ö§³Ö¾ÛºÏº¯Êý£¨ÀýÈç SUM¡¢COUNT£©¡£

UNION ²»Ö§³Ö ORDER BY ×Ӿ䡣

UNION ¿ÉÄÜÔÚÐÔÄÜÉϱÈÆäËûÍŽá²Ù×÷·û£¨Èç UNION ALL£©Âý¡£

ÒÔÉϾÍÊÇmysqlÖÐunionʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ