mysqlÖв¢ÇÒÓÃʲô´ú±í
and ÔËËã·ûÓÃÓÚÅþÁ¬¶à¸öÌõ¼þ£¬Ö»Óе±ËùÓÐÌõ¼þ¶¼Öª×ãʱ£¬Ð§¹û²ÅΪÕæ¡£Óï·¨£ºÌõ¼þ1 and Ìõ¼þ2 … [and Ìõ¼þn]¡£Ó÷¨°üÀ¨£º×éºÏËÑË÷Ìõ¼þ¡¢¹ýÂËÖØ´óÊý¾Ý¡¢½¨Éè×ÓÅÌÎÊÌõ¼þ¡£×¢ÖØ£ºÓÅÏȼ¶¸ßÓÚ or ÔËËã·û£¬¿ÕÖµÓëÕæ»ò¼ÙÒ»ÆðʹÓÃʱЧ¹ûʼÖÕΪ¼Ù¡£
MySQL Öеġ°AND¡±ÔËËã·û
AND ÔËËã·ûµÄ×÷ÓÃ
AND ÔËËã·ûÓÃÓÚ½«Á½¸ö»ò¶à¸öÌõ¼þÅþÁ¬ÔÚÒ»Æð£¬Ö»Óе±ËùÓÐÌõ¼þ¶¼Öª×ãʱ£¬Ð§¹û²ÅΪÕæ¡£
Óï·¨
Ìõ¼þ1 AND Ìõ¼þ2 … [AND Ìõ¼þn]
ʾÀý
¼ÙÉèÎÒÃÇÓÐÒ»¸öÃûΪ users µÄ±í£¬ ????? ???? ??? id¡¢name ºÍ age¡£ ҪѡÔñËùÓÐÄêËê´óÓÚ 20 ÇÒÐÕÃûÒÔ “J” ¿ªÍ·µÄÓû§£¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÅÌÎÊ£º
SELECT * FROM users WHERE age > 20 AND name LIKE 'J%';
µÇ¼ºó¸´ÖÆ
Ó÷¨
AND ÔËËã·ûͨ³£ÓÃÓÚ£º
½«¶à¸öËÑË÷Ìõ¼þ×éºÏÔÚÒ»Æð
¹ýÂ˳öÖª×ãÌض¨ÖØ´óÌõ¼þµÄÊý¾Ý
ÔÚ×ÓÅÌÎÊÖн¨Éè¸üÖØ´óµÄÌõ¼þ
×¢ÖØ
ÔËËã·ûµÄÓÅÏȼ¶¸ßÓÚ OR ÔËËã·û
¿ÉÒÔʹÓÃÀ¨ºÅÀ´¸Ä±äÔËËã·ûµÄÖ´ÐÐ˳Ðò
¿ÕÖµ²»»áÓ°Ïì AND ÔËËã·ûµÄЧ¹û£»¼´¿ÕÖµÓëÕæ»ò¼ÙÒ»ÆðʹÓÃʱЧ¹ûʼÖÕΪ¼Ù
ÒÔÉϾÍÊÇmysqlÖв¢ÇÒÓÃʲô´ú±íµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡