{"id":7141,"date":"2024-11-14T11:56:21","date_gmt":"2024-11-14T03:56:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7141\/"},"modified":"2024-11-14T11:56:21","modified_gmt":"2024-11-14T03:56:21","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e5%ad%90%e6%9f%a5%e8%af%a2%e4%b8%ad%e7%9a%84%e5%8f%82%e6%95%b0%e4%b8%8e%e5%a4%96%e5%b1%82-sql-%e8%af%ad%e5%8f%a5%e4%b8%ad%e7%9a%84%e5%ad%97%e6%ae%b5%e8%bf%9b%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7141\/","title":{"rendered":"\u5982\u4f55\u5c06\u5b50\u67e5\u8be2\u4e2d\u7684\u53c2\u6570\u4e0e\u5916\u5c42 SQL \u8bed\u53e5\u4e2d\u7684\u5b57\u6bb5\u8fdb\u884c\u6bd4\u8f83\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173051496413473.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5c06\u5b50\u67e5\u8be2\u4e2d\u7684\u53c2\u6570\u4e0e\u5916\u5c42 SQL \u8bed\u53e5\u4e2d\u7684\u5b57\u6bb5\u8fdb\u884c\u6bd4\u8f83\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5c06\u5b50\u67e5\u8be2\u4e2d\u7684\u53c2\u6570\u4e0e\u5916\u5c42 SQL \u8bed\u53e5\u4e2d\u7684\u5b57\u6bb5\u8fdb\u884c\u6bd4\u8f83\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 sql \u8bed\u53e5\u4e2d\u4f20\u9012\u53c2\u6570<\/strong><\/p>\n<p>\u672c\u95ee\u9898\u6d89\u53ca\u5728 sql \u8bed\u53e5\u4e2d\u4f20\u9012\u53c2\u6570\uff0c\u5177\u4f53\u5982\u4e0b\uff1a<\/p>\n<pre>update post set content = (\n    select group_concat(id) as ids\n    from article\n    where pid = 'id'\n)\nwhere id &lt; 720<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u95ee\u9898\u4e2d\u7684\u4ee3\u7801\u9700\u8981\u5c06 article \u8868\u4e2d pid \u5b57\u6bb5\u7b49\u4e8e post \u8868 id \u5b57\u6bb5\u7684\u8bb0\u5f55\u7684 id \u503c\u62fc\u63a5\u5728\u4e00\u8d77\u3002\u4f46\u76ee\u524d\u4ee3\u7801\u4e2d\u7684 id \u5374\u662f\u4f5c\u4e3a\u5b57\u7b26\u4e32\uff0c\u65e0\u6cd5\u4e0e post \u8868\u4e2d\u7684 id \u5b57\u6bb5\u6bd4\u8f83\u3002<\/p>\n<p><strong>\u7b54\u6848\uff1a<\/strong><\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u5b50\u67e5\u8be2\u5e76\u5c06 post \u8868\u522b\u540d\u4e3a a\uff1a<\/p>\n<pre>UPDATE post a SET content = (\n    SELECT group_concat(id) AS ids\n    FROM article\n    WHERE pid = a.id\n)\nWHERE a.id &lt; 720<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b64\u4fee\u6539\u5c06 pid \u66ff\u6362\u4e3a a.id\uff0c\u4f7f\u5176\u4e0e\u5b50\u67e5\u8be2\u4e2d\u7684 id \u5b57\u6bb5\u8fdb\u884c\u6bd4\u8f83\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5c06\u5b50\u67e5\u8be2\u4e2d\u7684\u53c2\u6570\u4e0e\u5916\u5c42 SQL \u8bed\u53e5\u4e2d\u7684\u5b57\u6bb5\u8fdb\u884c\u6bd4\u8f83\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\u4f7f\u7528 sql \u8bed\u53e5\u4e2d\u4f20\u9012\u53c2\u6570 \u672c\u95ee\u9898\u6d89\u53ca\u5728 sql \u8bed\u53e5\u4e2d\u4f20\u9012\u53c2\u6570\uff0c\u5177\u4f53\u5982\u4e0b\uff1a update post set content = ( select group_concat(id) as ids from article where pid = &#8216;id&#8217; ) where id &lt; 720 \u767b\u5f55\u540e\u590d\u5236 \u95ee\u9898\uff1a \u95ee\u9898\u4e2d\u7684\u4ee3\u7801\u9700\u8981\u5c06 article \u8868\u4e2d pid \u5b57\u6bb5\u7b49\u4e8e post \u8868 id \u5b57\u6bb5\u7684\u8bb0\u5f55\u7684 id \u503c\u62fc\u63a5\u5728\u4e00\u8d77\u3002\u4f46\u76ee\u524d\u4ee3\u7801\u4e2d\u7684 id \u5374\u662f\u4f5c\u4e3a\u5b57\u7b26\u4e32\uff0c\u65e0\u6cd5\u4e0e post \u8868\u4e2d\u7684 id \u5b57\u6bb5\u6bd4\u8f83\u3002 \u7b54\u6848\uff1a \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u5b50\u67e5\u8be2\u5e76\u5c06 post \u8868\u522b\u540d\u4e3a a\uff1a UPDATE post a SET [&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-7141","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7141","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=7141"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7141\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}