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

thinkphpÔõÑùÅÌÎÊÊý¾Ý¿âÖеÄÖظ´Êý¾Ý

Ê×ÏÈ£¬ÈÃÎÒÃǼÙÉèÄãÒѾ­ÓÐÁËÒ»¸öÊý¾Ý¿â±í¡£¼ÙÉèÓÐÒ»ÕÅÃûΪ¡°students¡±µÄ±í¸ñ£¬ÆäÖаüÀ¨ÒÔÏÂÈý¸ö×ֶΣºid¡¢nameºÍage¡£ÏÖÔÚ£¬ÎÒÃÇÏëÒªÕÒ³öÄÄЩѧÉúµÄÐÕÃûÔÚÊý¾Ý¿âÖÐÊÇÖظ´µÄ¡£

ʹÓÃThinkPHP£¬¿ÉÒÔÇáËɵشӱíÖÐÅÌÎÊÖظ´µÄÊý¾Ý¡£ÏÂÃæÊÇÒ»¸öÅÌÎÊÖظ´Êý¾ÝµÄʾÀý´úÂ룺

$students = Db::name('students')->field('name, count(name) as count')->group('name')->having('count>1')->select();

µÇ¼ºó¸´ÖÆ

ÈÃÎÒÃÇÖðÒ»Ú¹ÊÍÕâ¸ö´úÂëµÄÿһ²¿·Ö¡£

Ê×ÏÈ£¬ÎÒÃÇʹÓÃDbÀàµÄ³£Á¿ name ÒªÁì»ñµÃstudents±íµÄÃû³Æ¡£ÔÚÕâ¸öÀý×ÓÖУ¬ÎÒÃÇʹÓÃÁË field ÒªÁ콫Á½¸ö×ֶηµ»Øµ½Ð§¹û¼¯ÖУºÐÕÃûºÍ¼ÆÊý¡£count(name) º¯ÊýÓÃÓÚ½«Í¬ÃûµÄЧ¹û¼ÆÊý¡£ÎÒÃǽ«Ð§¹ûƾ֤ÐÕÃû·Ö×飬ʹÓà having º¯ÊýÀ´¹ýÂ˼ÆÊý´óÓÚ1µÄЧ¹û¡£×îºó£¬ÎÒÃÇʹÓà select º¯Êý·µ»ØÊý¾Ý¡£

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡± £»

ÎÒÃÇ¿ÉÒÔ²éÕÒѧÉú±íÖÐÖظ´µÄÐÕÃû£¬²¢ÅÌËãÿ¸öÖظ´Ïî·ºÆðµÄ´ÎÊý¡£ÎÒÃǽ«Äܹ»¿ìËÙ¶¨Î»µ½ÎÒÃÇÐèÒª²éÕÒµÄÊý¾Ý²¢¾ÙÐнøÒ»²½´¦Àí¡£

¿ÉÊÇ£¬ÕâÖÖÒªÁì¿ÉÄܱ£´æһЩÏÞÖÆ¡£Ê×ÏÈ£¬ÎÒÃÇ¿ÉÄÜÐèÒª¸ü¶àµÄÊý¾ÝÀ´È·¶¨Öظ´ÏÓÉÓÚÕâ¸öÒªÁìÖ»ÄÜÕÒµ½Öظ´ÏîµÄÃû³Æ£¬¶ø²»¿ÉÕÒµ½ÆäËûÁÐÖеÄÖظ´Ïî¡£ÁíÍ⣬ÕâÖÖÒªÁìÐèҪɨÃèÕû¸ö±íÒÔ²éÕÒÖظ´Ï¿ÉÄܻᵼÖÂÐÔÄÜÎÊÌâ¡£

Òò´Ë£¬ÔÚÏÖÕæÏླÖУ¬ÎÒÃÇ¿ÉÒÔ½ÓÄɸüÓÐÓÃÂʵÄÅÌÎÊ·½·¨À´Ñ°ÕÒÖظ´Êý¾Ý¡£Êý¾Ý¿âÉè¼Æ½ÓÄÉË÷ÒýºÍ¸´ºÏ¼ü¿É´ó·ùÌáÉýÅÌÎÊЧÂÊ£¬´Ó¶ø¿ìËÙ¶¨Î»µ½Öظ´Ïî¡£

ÒÔÉϾÍÊÇthinkphpÔõÑùÅÌÎÊÊý¾Ý¿âÖеÄÖظ´Êý¾ÝµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ