{"id":111,"date":"2023-06-27T16:57:58","date_gmt":"2023-06-27T08:57:58","guid":{"rendered":"https:\/\/jiachen.de.cool\/blog\/?p=111"},"modified":"2023-06-28T13:49:24","modified_gmt":"2023-06-28T05:49:24","slug":"%e5%90%88%e5%b9%b6%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/jiachen.de.cool\/blog\/2023\/06\/27\/%e5%90%88%e5%b9%b6%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%87%bd%e6%95%b0\/","title":{"rendered":"\u5408\u5e76\u5b57\u7b26\u4e32\u51fd\u6570"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">concat()\u51fd\u6570\u4f1a\u5c06\u4f20\u5165\u7684\u53c2\u6570\u8fde\u63a5\u8d77\u6765\u8fd4\u56de\u5408\u5e76\u7684\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u6570\u636e\u3002\u5982\u679c\u5176\u4e2d\u4e00\u4e2a\u53c2\u6570\u4e3anull\uff0c\u5219\u8fd4\u56de\u503c\u4e3anull\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">concat_ws()\u51fd\u6570\u4e0econcat()\u76f8\u6bd4\uff0c\u591a\u4e86\u4e00\u4e2a\u8868\u793a\u5206\u9694\u7b26\u7684seq\u53c2\u6570\uff0c\u4e0d\u4ec5\u5c06\u4f20\u5165\u7684\u5176\u4ed6\u53c2\u6570\u8fde\u63a5\u8d77\u6765\uff0c\u800c\u4e14\u8fd8\u4f1a\u901a\u8fc7\u5206\u9694\u7b26\u5c06\u5404\u4e2a\u5b57\u7b26\u4e32\u5206\u5272\u5f00\u6765\u3002\u5206\u9694\u7b26\u53ef\u4ee5\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u4e5f\u53ef\u4ee5\u662f\u5176\u4ed6\u53c2\u6570\u3002\u5982\u679c\u5206\u9694\u7b26\u4e3anull\uff0c\u5219\u8fd4\u56de\u7ed3\u679c\u4e3anull\u3002\u51fd\u6570\u4f1a\u5ffd\u7565\u4efb\u4f55\u5206\u9694\u7b26\u540e\u7684\u53c2\u6570null\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql&gt; select concat('huang','lao','shi'),concat('huang','lao','shi',null);\n+-----------------------------+----------------------------------+\n| concat('huang','lao','shi') | concat('huang','lao','shi',null) |\n+-----------------------------+----------------------------------+\n| huanglaoshi                 | NULL                             |\n+-----------------------------+----------------------------------+\n1 row in set (0.01 sec)\n\nmysql&gt; select concat(curdate(),12.2);\n+------------------------+\n| concat(curdate(),12.2) |\n+------------------------+\n| 2023-06-2712.2         |\n+------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('-','020','83378683');\n+---------------------------------+\n| concat_ws('-','020','83378683') |\n+---------------------------------+\n| 020-83378683                    |\n+---------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat('-','020','83378683');\n+------------------------------+\n| concat('-','020','83378683') |\n+------------------------------+\n| -02083378683                 |\n+------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('-','020','83378683','83378683');\n+--------------------------------------------+\n| concat_ws('-','020','83378683','83378683') |\n+--------------------------------------------+\n| 020-83378683-83378683                      |\n+--------------------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws(null,'020','83378683'),concat_ws('-','020',null,'8337868\n3');\n+----------------------------------+--------------------------------------+\n| concat_ws(null,'020','83378683') | concat_ws('-','020',null,'83378683') |\n+----------------------------------+--------------------------------------+\n| NULL                             | 020-83378683                         |\n+----------------------------------+--------------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('\/','83378683');\n+---------------------------+\n| concat_ws('\/','83378683') |\n+---------------------------+\n| 83378683                  |\n+---------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('+','83378683');\n+---------------------------+\n| concat_ws('+','83378683') |\n+---------------------------+\n| 83378683                  |\n+---------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('\/','83378683','83378683');\n+--------------------------------------+\n| concat_ws('\/','83378683','83378683') |\n+--------------------------------------+\n| 83378683\/83378683                    |\n+--------------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('\/','020','83378683');\n+---------------------------------+\n| concat_ws('\/','020','83378683') |\n+---------------------------------+\n| 020\/83378683                    |\n+---------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('or','010','83378683','83378683');\n+---------------------------------------------+\n| concat_ws('or','010','83378683','83378683') |\n+---------------------------------------------+\n| 010or83378683or83378683                     |\n+---------------------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('abc','010','83378683');\n+-----------------------------------+\n| concat_ws('abc','010','83378683') |\n+-----------------------------------+\n| 010abc83378683                    |\n+-----------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; select concat_ws('--','010','83378683','83378683');\n+---------------------------------------------+\n| concat_ws('--','010','83378683','83378683') |\n+---------------------------------------------+\n| 010--83378683--83378683                     |\n+---------------------------------------------+\n1 row in set (0.00 sec)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>concat()\u51fd\u6570\u4f1a\u5c06\u4f20\u5165\u7684\u53c2\u6570\u8fde\u63a5\u8d77\u6765\u8fd4\u56de\u5408\u5e76\u7684\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u6570\u636e\u3002\u5982\u679c\u5176\u4e2d\u4e00\u4e2a\u53c2\u6570\u4e3anull\uff0c\u5219\u8fd4\u56de\u503c\u4e3an&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/jiachen.de.cool\/blog\/2023\/06\/27\/%e5%90%88%e5%b9%b6%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%87%bd%e6%95%b0\/\">Read the full article<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[21,19,20],"class_list":["post-111","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-21","tag-19","tag-20"],"_links":{"self":[{"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/posts\/111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/comments?post=111"}],"version-history":[{"count":3,"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":114,"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/posts\/111\/revisions\/114"}],"wp:attachment":[{"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/media?parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/categories?post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jiachen.de.cool\/blog\/wp-json\/wp\/v2\/tags?post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}