×ðÁú¿­Ê±¹ÙÍøµÇ¼

mysqlÖеÄinÊÇʲôÒâ˼

mysql ÖÐµÄ in ÔËËã·ûÓÃÓÚ¼ì²éÒ»¸öÖµÊÇ·ñ°üÀ¨ÔÚÒ»¸öÖ¸¶¨ÁбíÖÐ £¬Ó﷨Ϊ£ºselect column_name from table_name where column_name in (value1, value2, …, valuen)¡£ÆäÓÅÊÆ°üÀ¨Ð§Âʸߡ¢Ò×ÓÃÐԺͿÉÀ©Õ¹ÐÔ¡£ÐèҪעÖصÄÊÇ £¬¹ØÓÚ´óÐÍÁбí»ò null Öµ £¬Ëü¿ÉÄܻᵼÖÂÐÔÄÜÎÊÌâ¡£

MySQL ÖÐµÄ IN ÔËËã·û

MySQL ÖÐµÄ IN ÔËËã·ûÓÃÓÚ¼ì²éÒ»¸öÖµÊÇ·ñ°üÀ¨ÔÚÒ»¸öÖ¸¶¨ÁбíÖС£Óï·¨ÈçÏ£º

SELECT column_name
FROM table_name
WHERE column_name IN (value1, value2, ..., valueN);

µÇ¼ºó¸´ÖÆ

ÔõÑùʹÓà IN ÔËËã·û

¿ÉÒÔʹÓà IN ÔËËã·ûÓë¶à¸öÖµ¾ÙÐнÏÁ¿ £¬ÒÔ¼ì²éÌض¨ÖµÊÇ·ñ±£´æÓÚ¸ÃÁбíÖС£ÀýÈç £¬Òª²éÕÒ°üÀ¨Öµ 5¡¢7 »ò 9 µÄ “id” ÁÐ £¬¿ÉÒÔʹÓÃÒÔÏÂÅÌÎÊ£º

SELECT id
FROM table_name
WHERE id IN (5, 7, 9);

µÇ¼ºó¸´ÖÆ

IN ÔËËã·ûµÄÓÅÊÆ

ЧÂÊ£º¹ØÓÚ¼ì²é¶à¸öÖµÊÇ·ñ°üÀ¨ÔÚÒ»¸öÁбíÖÐ £¬IN ÔËËã·û±ÈʹÓöà¸ö OR ÔËËã·û¸üΪ¸ßЧ¡£

Ò×ÓÚʹÓãºÊ¹Óà IN ÔËËã·ûºÜÊǼòÆÓÃ÷Îú £¬ÎÞÐè±àдÖØ´óµÄÅÌÎÊ¡£

¿ÉÀ©Õ¹ÐÔ£ºIN ÔËËã·ûÖ§³Öí§ÒâÊýÄ¿µÄÖµ £¬Òò´ËºÜÊÇÊʺϴ¦Àí´óÐÍÊý¾Ý¼¯¡£

×¢ÖØÊÂÏî

IN ÔËËã·û¹ØÓÚСÁбíºÜÊÇÓÐÓà £¬µ«¹ØÓÚ´óÐÍÁбí¿ÉÄܻᵼÖÂÐÔÄÜÎÊÌâ¡£

ÈôÊÇÒª¼ì²éµÄֵΪ NULL £¬Ôò IN ÔËËã·û½«Ê¼ÖÕ·µ»Ø FALSE £¬ÓÉÓÚ NULL ²»¼´ÊÇÈκÎÖµ¡£

IN ÔËËã·û¹ØÓÚ·ÇÊý×ÖÀàÐ͵ÄÁУ¨ÀýÈç×Ö·û´®»òÈÕÆÚ£©Ò²ÊÇÓÐÓõÄ¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ