{"id":26106,"date":"2024-11-24T13:07:14","date_gmt":"2024-11-24T05:07:14","guid":{"rendered":"https:\/\/fwq.ai\/blog\/26106\/"},"modified":"2024-11-24T13:07:14","modified_gmt":"2024-11-24T05:07:14","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e8%af%a2-mysql-%e8%a1%a8%e4%b8%ad%e5%85%b7%e6%9c%89%e4%b8%a4%e4%b8%aa%e4%bb%a5%e4%b8%8a%e7%9b%b8%e5%90%8c%e6%95%b0%e6%8d%ae%e7%9a%84%e4%b8%a4%e4%b8%aa%e5%ad%97%e6%ae%b5-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/26106\/","title":{"rendered":"\u5982\u4f55\u67e5\u8be2 MySQL \u8868\u4e2d\u5177\u6709\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u4e24\u4e2a\u5b57\u6bb5\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173080116371425.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u67e5\u8be2 MySQL \u8868\u4e2d\u5177\u6709\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u4e24\u4e2a\u5b57\u6bb5\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u67e5\u8be2 MySQL \u8868\u4e2d\u5177\u6709\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u4e24\u4e2a\u5b57\u6bb5\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u8be2  \u4e2d\u5177\u6709\u4e24\u6761\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u4e24\u4e2a\u5b57\u6bb5\uff1f<\/strong><\/p>\n<p>\u5047\u8bbe\u6709\u4e00\u5f20\u540d\u4e3a wx_material \u7684\u8868\uff0c\u5176\u4e2d\u5305\u542b zxtid \u548c billuuid \u5b57\u6bb5\u3002\u60a8\u5e0c\u671b\u67e5\u627e\u5177\u6709\u4e24\u4e2a\u4ee5\u4e0a\u91cd\u590d\u6570\u636e\u7684 zxtid \u548c billuuid \u5b57\u6bb5\u5bf9\u3002<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u4ee5\u91c7\u7528\u5d4c\u5957 select \u8bed\u53e5\u7684\u65b9\u6cd5\uff1a<\/p>\n<pre>select\n    b.* \nfrom\n    wx_material b,\n    ( select zxtid, billuuid from wx_material group by zxtid, billuuid having count(zxtid + billuuid) &gt; 1 ) as a \nwhere\n    a.zxtid = b.zxtid \n    and a.billuuid = b.billuuid<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u4e2a\u67e5\u8be2\u4ece wx_material \u8868\u4e2d\u9009\u62e9\u6240\u6709\u884c\uff0c\u5e76\u5c06\u5b83\u4eec\u4e0e\u4e00\u4e2a\u5b50\u67e5\u8be2\u7684\u7ed3\u679c\u8fde\u63a5\u8d77\u6765\u3002\u5b50\u67e5\u8be2\u8fd4\u56de\u6240\u6709 zxtid \u548c billuuid \u5bf9\u7684\u5217\u8868\uff0c\u8fd9\u4e9b\u5bf9\u5177\u6709\u4e24\u4e2a\u4ee5\u4e0a\u91cd\u590d\u7684\u6570\u636e\u3002<\/p>\n<p>\u901a\u8fc7\u4f7f\u7528\u5916\u90e8 select \u8bed\u53e5\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u5d4c\u5957\u67e5\u8be2\u4e2d\u7684\u6240\u6709\u884c\uff0c\u4ece\u800c\u68c0\u7d22\u539f\u59cb\u8868\u4e2d\u5177\u6709\u91cd\u590d\u6570\u636e\u7684\u884c\u3002\u8fd9\u5c06\u8fd4\u56de\u60a8\u60f3\u8981\u7684\u7ed3\u679c\uff1a<\/p>\n<pre>id   zxtId     billUuid   add\n1    123       A009       0309\u53f7\n2    123       A009       0310\u53f7\n3    126       A011       0315\u53f7\n4    126       A011       0322\u53f7<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u67e5\u8be2 MySQL \u8868\u4e2d\u5177\u6709\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u4e24\u4e2a\u5b57\u6bb5\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u67e5\u8be2 \u4e2d\u5177\u6709\u4e24\u6761\u4ee5\u4e0a\u76f8\u540c\u6570\u636e\u7684\u4e24\u4e2a\u5b57\u6bb5\uff1f \u5047\u8bbe\u6709\u4e00\u5f20\u540d\u4e3a wx_material \u7684\u8868\uff0c\u5176\u4e2d\u5305\u542b zxtid \u548c billuuid \u5b57\u6bb5\u3002\u60a8\u5e0c\u671b\u67e5\u627e\u5177\u6709\u4e24\u4e2a\u4ee5\u4e0a\u91cd\u590d\u6570\u636e\u7684 zxtid \u548c billuuid \u5b57\u6bb5\u5bf9\u3002 \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u4ee5\u91c7\u7528\u5d4c\u5957 select \u8bed\u53e5\u7684\u65b9\u6cd5\uff1a select b.* from wx_material b, ( select zxtid, billuuid from wx_material group by zxtid, billuuid having count(zxtid + billuuid) &gt; 1 ) as a where a.zxtid = b.zxtid and a.billuuid = b.billuuid \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e2a\u67e5\u8be2\u4ece wx_material \u8868\u4e2d\u9009\u62e9\u6240\u6709\u884c\uff0c\u5e76\u5c06\u5b83\u4eec\u4e0e\u4e00\u4e2a\u5b50\u67e5\u8be2\u7684\u7ed3\u679c\u8fde\u63a5\u8d77\u6765\u3002\u5b50\u67e5\u8be2\u8fd4\u56de\u6240\u6709 zxtid \u548c billuuid [&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-26106","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26106","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=26106"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26106\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=26106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=26106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=26106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}