{"id":7420,"date":"2024-11-14T15:05:36","date_gmt":"2024-11-14T07:05:36","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7420\/"},"modified":"2024-11-14T15:05:36","modified_gmt":"2024-11-14T07:05:36","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e8%af%a2-mysql-%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%ad%e9%87%8d%e5%a4%8d%e6%95%b0%e6%8d%ae%e8%b6%85%e8%bf%87%e4%b8%a4%e6%9d%a1%e7%9a%84%e8%ae%b0%e5%bd%95%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7420\/","title":{"rendered":"\u5982\u4f55\u67e5\u8be2 MySQL \u6570\u636e\u5e93\u4e2d\u91cd\u590d\u6570\u636e\u8d85\u8fc7\u4e24\u6761\u7684\u8bb0\u5f55\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173080424378287.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u67e5\u8be2 MySQL \u6570\u636e\u5e93\u4e2d\u91cd\u590d\u6570\u636e\u8d85\u8fc7\u4e24\u6761\u7684\u8bb0\u5f55\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u67e5\u8be2 MySQL \u6570\u636e\u5e93\u4e2d\u91cd\u590d\u6570\u636e\u8d85\u8fc7\u4e24\u6761\u7684\u8bb0\u5f55\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u8be2\u91cd\u590d\u6570\u636e\u8d85\u8fc7\u4e24\u6761\u7684  \u8bb0\u5f55<\/strong><\/p>\n<p>\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u6709\u65f6\u9700\u8981\u67e5\u627e\u67d0\u4e9b\u5b57\u6bb5\u5b58\u5728\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u8bb0\u5f55\u3002\u4f7f\u7528 group by \u548c having count() \u6761\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e00\u76ee\u7684\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>select *\nfrom wx_material\ngroup by zxtid,billuuid\nhaving count(zxtid + billuuid) &gt; 1;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u800c\uff0c\u6b64\u67e5\u8be2\u4ec5\u8fd4\u56de\u4e00\u6761\u91cd\u590d\u7684\u8bb0\u5f55\u3002\u4e3a\u4e86\u83b7\u53d6\u6240\u6709\u91cd\u590d\u8bb0\u5f55\uff0c\u53ef\u4ee5\u4f7f\u7528\u5916\u90e8 select \u8bed\u53e5\uff1a<\/p>\n<pre>SELECT\n    b.*\nFROM\n    app_duty_sign_in_range b,\n    ( SELECT location, latitude FROM app_duty_sign_in_range GROUP BY location, latitude HAVING count( location + \"\" + latitude ) &gt; 1 ) AS a\nWHERE\n    a.location = b.location\n    AND a.latitude = b.latitude;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u67e5\u8be2\u5c06\u4ece\u8868 app_duty_sign_in_range \u4e2d\u68c0\u7d22\u6240\u6709\u5177\u6709\u91cd\u590d\u4f4d\u7f6e\u548c\u7eac\u5ea6\u7684\u8bb0\u5f55\u3002a \u5b50\u67e5\u8be2\u8fd4\u56de\u91cd\u590d\u8bb0\u5f55\u7684\u552f\u4e00\u4f4d\u7f6e\u548c\u7eac\u5ea6\u7ec4\u5408\uff0c\u800c\u5916\u90e8 select \u8bed\u53e5\u8fd4\u56de\u8fd9\u4e9b\u7ec4\u5408\u5bf9\u5e94\u7684\u5b8c\u6574\u8bb0\u5f55\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u67e5\u8be2 MySQL \u6570\u636e\u5e93\u4e2d\u91cd\u590d\u6570\u636e\u8d85\u8fc7\u4e24\u6761\u7684\u8bb0\u5f55\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u67e5\u8be2\u91cd\u590d\u6570\u636e\u8d85\u8fc7\u4e24\u6761\u7684 \u8bb0\u5f55 \u5728\u6570\u636e\u5e93\u4e2d\uff0c\u6709\u65f6\u9700\u8981\u67e5\u627e\u67d0\u4e9b\u5b57\u6bb5\u5b58\u5728\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u8bb0\u5f55\u3002\u4f7f\u7528 group by \u548c having count() \u6761\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e00\u76ee\u7684\uff0c\u5982\u4e0b\u6240\u793a\uff1a select * from wx_material group by zxtid,billuuid having count(zxtid + billuuid) &gt; 1; \u767b\u5f55\u540e\u590d\u5236 \u7136\u800c\uff0c\u6b64\u67e5\u8be2\u4ec5\u8fd4\u56de\u4e00\u6761\u91cd\u590d\u7684\u8bb0\u5f55\u3002\u4e3a\u4e86\u83b7\u53d6\u6240\u6709\u91cd\u590d\u8bb0\u5f55\uff0c\u53ef\u4ee5\u4f7f\u7528\u5916\u90e8 select \u8bed\u53e5\uff1a SELECT b.* FROM app_duty_sign_in_range b, ( SELECT location, latitude FROM app_duty_sign_in_range GROUP BY location, latitude HAVING count( location + &#8220;&#8221; + latitude ) &gt; 1 ) AS a WHERE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7420","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=7420"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7420\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}