{"id":200448,"date":"2025-05-06T10:03:26","date_gmt":"2025-05-06T02:03:26","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200448\/"},"modified":"2025-05-06T10:03:26","modified_gmt":"2025-05-06T02:03:26","slug":"%e5%a6%82%e4%bd%95%e4%bc%98%e5%8c%96-mysql-%e6%9f%a5%e8%af%a2%e4%bb%a5%e5%b0%86-10-%e5%88%86%e9%92%9f%e7%9a%84%e6%9f%a5%e8%af%a2%e6%97%b6%e9%97%b4%e7%bc%a9%e7%9f%ad%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200448\/","title":{"rendered":"\u5982\u4f55\u4f18\u5316 MySQL \u67e5\u8be2\u4ee5\u5c06 10 \u5206\u949f\u7684\u67e5\u8be2\u65f6\u95f4\u7f29\u77ed\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u5982\u4f55\u4f18\u5316 MySQL \u67e5\u8be2\u4ee5\u5c06 10 \u5206\u949f\u7684\u67e5\u8be2\u65f6\u95f4\u7f29\u77ed\uff1f<\/h1>\n<p>\u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6570\u636e\u5e93\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300a\u5982\u4f55\u4f18\u5316 MySQL \u67e5\u8be2\u4ee5\u5c06 10 \u5206\u949f\u7684\u67e5\u8be2\u65f6\u95f4\u7f29\u77ed\uff1f\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241105\/17307877006729b9747823f.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u4f18\u5316 mysql \u67e5\u8be2\u4ee5\u63d0\u5347\u6027\u80fd<\/strong><\/p>\n<p>\u9488\u5bf9\u7ed9\u5b9a\u7684\u67e5\u8be2\uff0c\u9700\u8981\u8fdb\u884c\u4f18\u5316\u4ee5\u7f29\u77ed\u67e5\u8be2\u65f6\u95f4\uff0c\u76ee\u524d\u67e5\u8be2\u9700\u8981\u7ea6 10 \u5206\u949f\u3002 <\/p>\n<p><strong>\u95ee\u9898\u5206\u6790<\/strong><\/p>\n<p>\u6267\u884c\u89e3\u91ca\u8ba1\u5212\u663e\u793a\uff0ca \u8868\u672a\u8d70\u7d22\u5f15\uff0cb \u8868\u8d70\u7684\u662f id \u7d22\u5f15\u3002 <\/p>\n<p><strong>\u4f18\u5316\u601d\u8def<\/strong><\/p>\n<ol>\n<li><strong>\u68c0\u67e5\u7d22\u5f15\uff1a<\/strong><br \/>\u786e\u4fdd a \u8868\u548c b \u8868\u4e0a\u90fd\u6709\u9002\u5f53\u7684\u7d22\u5f15\u3002\u5bf9\u4e8e a \u8868\uff0c\u5e94\u5efa\u7acb old_person_id \u5217\u7684\u7d22\u5f15\u3002\u5bf9\u4e8e b \u8868\uff0c\u5e94\u5efa\u7acb city \u548c shequ \u5217\u7684\u7d22\u5f15\u3002 <\/li>\n<li>\n<p><strong>\u53cd\u5411\u67e5\u8be2\uff1a<\/strong><br \/>\u5c06\u67e5\u8be2\u65b9\u5f0f\u53cd\u8f6c\u3002\u9996\u5148\u4ece b \u8868\u4e2d\u67e5\u8be2\u6ee1\u8db3\u6761\u4ef6\u7684\u884c\uff0c\u7136\u540e\u4f7f\u7528\u8fd9\u4e9b\u884c\u4e2d\u7684 id \u503c\u4f5c\u4e3a\u8fc7\u6ee4\u5668\u67e5\u8be2 a \u8868\u3002 <\/p>\n<pre>select * from a where a.old_person_id in (\n    select id from b where b.city like '\u4eac%' and b.shequ like '\u5c71%'\n)<\/pre>\n<\/li>\n<li>\n<p><strong>\u5206\u7ec4\u6c47\u603b\uff1a<\/strong><br \/>\u5982\u679c\u53cd\u5411\u67e5\u8be2\u6709\u6548\uff0c\u5219\u53ef\u4ee5\u518d\u6b21 join b \u8868\uff0c\u5e76\u6839\u636e\u9700\u8981\u5206\u7ec4\u548c\u6c47\u603b\u7ed3\u679c\u3002 <\/p>\n<pre>SELECT\n    aa.ID_CARD,\n    aa.DEAL_AMOUNT,\n    b.STREET\nFROM\n    (\n        SELECT * FROM a WHERE a.OLD_PERSON_ID IN (\n            SELECT id FROM b WHERE b.CITY LIKE '\u4eac%' AND b.SHEQU LIKE '\u5c71%'\n        )\n    ) aa\nINNER JOIN b ON aa.OLD_PERSON_ID = b.ID\nGROUP BY\n    b.STREET<\/pre>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u9075\u5faa\u8fd9\u4e9b\u4f18\u5316\u6b65\u9aa4\uff0c\u5e94\u8be5\u53ef\u4ee5\u663e\u7740\u63d0\u5347\u67e5\u8be2\u6027\u80fd\uff0c\u7f29\u77ed\u67e5\u8be2\u65f6\u95f4\u3002 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a\u5982\u4f55\u4f18\u5316 MySQL \u67e5\u8be2\u4ee5\u5c06 10 \u5206\u949f\u7684\u67e5\u8be2\u65f6\u95f4\u7f29\u77ed\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f18\u5316 MySQL \u67e5\u8be2\u4ee5\u5c06 &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200448","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200448"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200448\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}