{"id":7088,"date":"2024-11-14T08:11:55","date_gmt":"2024-11-14T00:11:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7088\/"},"modified":"2024-11-14T08:11:55","modified_gmt":"2024-11-14T00:11:55","slug":"%e5%a6%82%e4%bd%95%e4%bc%98%e5%8c%96%e5%a4%a7%e5%9e%8b%e6%95%b0%e6%8d%ae%e5%ba%93%e7%b3%bb%e7%bb%9f%e4%b8%ad%e4%b8%a4%e4%b8%aa%e6%97%a0%e5%85%b3%e8%81%94%e8%a1%a8%e7%9a%84%e7%ac%9b%e5%8d%a1%e5%b0%94","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7088\/","title":{"rendered":"\u5982\u4f55\u4f18\u5316\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u7684\u7b1b\u5361\u5c14\u79ef\u67e5\u8be2\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173043216436284.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f18\u5316\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u7684\u7b1b\u5361\u5c14\u79ef\u67e5\u8be2\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f18\u5316\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u7684\u7b1b\u5361\u5c14\u79ef\u67e5\u8be2\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u6570\u636e\u5e93\u67e5\u8be2\u6548\u7387\u4f18\u5316<\/strong><\/p>\n<p>\u5728\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\uff0c\u67e5\u8be2\u6548\u7387\u5c24\u4e3a\u91cd\u8981\u3002\u672c\u6587\u5c06\u9488\u5bf9\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u7684\u7b1b\u5361\u5c14\u79ef\u95ee\u9898\u63d0\u51fa\u89e3\u51b3\u65b9\u6848\uff0c\u5e76\u6839\u636e\u5b9e\u9645\u573a\u666f\u7ed9\u51fa\u4f18\u5316\u67e5\u8be2\u8bed\u53e5\u7684\u5efa\u8bae\u3002<\/p>\n<p><strong>\u7b1b\u5361\u5c14\u79ef\u95ee\u9898<\/strong><\/p>\n<p>\u5f53\u67e5\u8be2\u6d89\u53ca\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u65f6\uff0c\u82e5\u6ca1\u6709\u4efb\u4f55\u7b5b\u9009\u6761\u4ef6\uff0c\u5c06\u4f1a\u4ea7\u751f\u7b1b\u5361\u5c14\u79ef\uff0c\u5bfc\u81f4\u7ed3\u679c\u96c6\u6570\u91cf\u5448\u51e0\u4f55\u500d\u6570\u589e\u957f\u3002\u4f8b\u5982\uff0c\u82e5\u8868 a \u6709 4 \u884c\uff0c\u8868 b \u6709 2 \u884c\uff0c\u65e0\u6761\u4ef6\u67e5\u8be2\u7684\u7ed3\u679c\u5c06\u4ea7\u751f 4 x 2 = 8 \u6761\u6570\u636e\u3002<\/p>\n<p><strong>\u4f18\u5316\u67e5\u8be2\u8bed\u53e5<\/strong><\/p>\n<p>\u82e5\u5b58\u5728\u7b2c\u4e09\u5f20\u8868 c \u4e0e\u8868 a \u548c b \u76f8\u5173\u8054\uff0c\u53ef\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\u4f18\u5316\u67e5\u8be2\u8bed\u53e5\uff1a<\/p>\n<ul>\n<li>\u4ee5\u6570\u636e\u8f83\u591a\u7684\u8868\u4f5c\u4e3a\u4e3b\u8868\uff0c\u5982\u8868 a\u3002<\/li>\n<li>\u4f7f\u7528 left join \u8bed\u53e5\u5173\u8054\u8868 c \u548c a\uff0c\u6309\u59d3\u540d\u7b5b\u9009\u3002<\/li>\n<li>\u518d\u4f7f\u7528 left join \u8bed\u53e5\u5173\u8054\u8868 b \u548c\u67e5\u8be2\u7ed3\u679c\uff0c\u6309\u7701\u4efd\u7b5b\u9009\u3002<\/li>\n<\/ul>\n<p>\u4f18\u5316\u540e\u7684\u67e5\u8be2\u8bed\u53e5\u5982\u4e0b\uff1a<\/p>\n<pre>SELECT A.*, B.*\nFROM C\n  LEFT JOIN A ON C.nid = A.id\n  LEFT JOIN B ON C.sid = B.id\nWHERE A.name = '\u5f20\u4e09' AND B.\u7701\u4efd = '\u4e0a\u6d77'<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u67e5\u8be2\u8bed\u53e5\u5229\u7528\u8868\u4e4b\u95f4\u7684\u5173\u8054\u5173\u7cfb\uff0c\u907f\u514d\u4e86\u7b1b\u5361\u5c14\u79ef\u3002<\/p>\n<p><strong>\u5176\u4ed6\u5efa\u8bae<\/strong><\/p>\n<p>\u6b64\u5916\uff0c\u4ee5\u4e0b\u5efa\u8bae\u4e5f\u6709\u52a9\u4e8e\u8fdb\u4e00\u6b65\u4f18\u5316\u67e5\u8be2\u6548\u7387\uff1a<\/p>\n<ul>\n<li>\u521b\u5efa\u9002\u5f53\u7684\u7d22\u5f15\u3002<\/li>\n<li>\u4f7f\u7528 expln \u8bed\u53e5\u5206\u6790\u67e5\u8be2\u6027\u80fd\u3002<\/li>\n<li>\u8003\u8651\u4f7f\u7528\u6570\u636e\u5e93\u5206\u7247\u6216\u6570\u636e\u4ed3\u5e93\u3002<\/li>\n<li>\u6839\u636e\u5b9e\u9645\u9700\u6c42\u5bf9\u8868\u7ed3\u6784\u8fdb\u884c\u4f18\u5316\uff0c\u5982\u5efa\u7acb\u5916\u952e\u7ea6\u675f\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f18\u5316\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u7684\u7b1b\u5361\u5c14\u79ef\u67e5\u8be2\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>\u6570\u636e\u5e93\u67e5\u8be2\u6548\u7387\u4f18\u5316 \u5728\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\uff0c\u67e5\u8be2\u6548\u7387\u5c24\u4e3a\u91cd\u8981\u3002\u672c\u6587\u5c06\u9488\u5bf9\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u7684\u7b1b\u5361\u5c14\u79ef\u95ee\u9898\u63d0\u51fa\u89e3\u51b3\u65b9\u6848\uff0c\u5e76\u6839\u636e\u5b9e\u9645\u573a\u666f\u7ed9\u51fa\u4f18\u5316\u67e5\u8be2\u8bed\u53e5\u7684\u5efa\u8bae\u3002 \u7b1b\u5361\u5c14\u79ef\u95ee\u9898 \u5f53\u67e5\u8be2\u6d89\u53ca\u4e24\u4e2a\u65e0\u5173\u8054\u8868\u65f6\uff0c\u82e5\u6ca1\u6709\u4efb\u4f55\u7b5b\u9009\u6761\u4ef6\uff0c\u5c06\u4f1a\u4ea7\u751f\u7b1b\u5361\u5c14\u79ef\uff0c\u5bfc\u81f4\u7ed3\u679c\u96c6\u6570\u91cf\u5448\u51e0\u4f55\u500d\u6570\u589e\u957f\u3002\u4f8b\u5982\uff0c\u82e5\u8868 a \u6709 4 \u884c\uff0c\u8868 b \u6709 2 \u884c\uff0c\u65e0\u6761\u4ef6\u67e5\u8be2\u7684\u7ed3\u679c\u5c06\u4ea7\u751f 4 x 2 = 8 \u6761\u6570\u636e\u3002 \u4f18\u5316\u67e5\u8be2\u8bed\u53e5 \u82e5\u5b58\u5728\u7b2c\u4e09\u5f20\u8868 c \u4e0e\u8868 a \u548c b \u76f8\u5173\u8054\uff0c\u53ef\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\u4f18\u5316\u67e5\u8be2\u8bed\u53e5\uff1a \u4ee5\u6570\u636e\u8f83\u591a\u7684\u8868\u4f5c\u4e3a\u4e3b\u8868\uff0c\u5982\u8868 a\u3002 \u4f7f\u7528 left join \u8bed\u53e5\u5173\u8054\u8868 c \u548c a\uff0c\u6309\u59d3\u540d\u7b5b\u9009\u3002 \u518d\u4f7f\u7528 left join \u8bed\u53e5\u5173\u8054\u8868 b \u548c\u67e5\u8be2\u7ed3\u679c\uff0c\u6309\u7701\u4efd\u7b5b\u9009\u3002 \u4f18\u5316\u540e\u7684\u67e5\u8be2\u8bed\u53e5\u5982\u4e0b\uff1a SELECT A.*, B.* FROM C LEFT JOIN A ON C.nid = A.id LEFT [&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-7088","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7088","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=7088"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7088\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}