尊龙凯时人生就是博

mysqlÖÐDISTINCTµÄÓ÷¨

distinct Òªº¦×ÖÓÃÓÚ´Ó mysql ÅÌÎÊЧ¹ûÖÐÈ¥³ýÖظ´ÐУ¬½ö±£´æΨһֵ¡£ÆäÓ÷¨°üÀ¨£ºdistinct column_name£º´ÓÖ¸¶¨ÁÐÖÐÈ¥³ýÖظ´Öµ¡£distinct(column_name1, column_name2, …)£º´Ó¶à¸öÁеÄ×éºÏÖÐÈ¥³ýÖظ´Öµ¡£

DISTINCT ÔÚ MySQL ÖеÄÓ÷¨

ÎÊÌ⣺DISTINCT ÔÚ MySQL ÖеÄ×÷ÓÃÊÇʲô£¿

½â´ð£º

DISTINCT Òªº¦×ÖÓÃÓÚ´ÓÅÌÎÊЧ¹ûÖÐÈ¥³ýÖظ´µÄÐУ¬½ö±£´æΨһֵ¡£

Ïêϸ˵Ã÷£º

DISTINCT ÓÐÒÔÏÂÓ÷¨£º

DISTINCT column_name£º´ÓÖ¸¶¨ÁÐÖÐÈ¥³ýÖظ´Öµ¡£

DISTINCT(column_name1, column_name2, …)£º´Ó¶à¸öÁеÄ×éºÏÖÐÈ¥³ýÖظ´Öµ¡£

×¢ÖØ£º

DISTINCT ÓÃÓÚÑ¡ÔñΨһÐУ¬¶ø²»ÊǹýÂËÖظ´Öµ¡£Öظ´ÖµÈÔÈ»±£´æÓÚЧ¹û¼¯ÖУ¬µ«²»»á±»ÏÔʾ¡£

DISTINCT ¶Ô NULL ÖµÃô¸Ð¡£NULL Öµ±»ÊÓΪΨһֵ¡£

ÔÚʹÓà DISTINCT ʱ£¬ORDER BY ×Ó¾ä»áÓ°ÏìЧ¹ûµÄ˳Ðò¡£

DISTINCT ¿ÉÒÔÓëÆäËû¾ÛºÏº¯Êý£¨Èç SUM¡¢COUNT¡¢AVG£©ÍŽáʹÓá£

ÔÚijЩÇéÐÎÏ£¬Ê¹Óà DISTINCT »á½µµÍÅÌÎÊÐÔÄÜ£¬ÌØÊâÊǹØÓÚ´óÐÍÊý¾Ý¼¯¡£

ʾÀý£º

SELECT DISTINCT name FROM customers;

µÇ¼ºó¸´ÖÆ

Õâ¸öÅÌÎʽ«´Ó “customers” ±íÖÐÑ¡ÔñËùÓÐΨһÃû³Æ¡£

SELECT DISTINCT city, country FROM customers;

µÇ¼ºó¸´ÖÆ

Õâ¸öÅÌÎʽ«´Ó “customers” ±íÖÐÑ¡ÔñΨһ¶¼»áºÍ¹ú¼Ò×éºÏ¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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