
{"id":1711,"date":"2022-05-17T17:19:00","date_gmt":"2022-05-17T09:19:00","guid":{"rendered":"http:\/\/dba.qishuo.xin\/?p=1711"},"modified":"2022-05-17T17:19:00","modified_gmt":"2022-05-17T09:19:00","slug":"mariadb%e4%b9%8bwith-as%e5%92%8cupdate%e7%94%a8%e6%b3%95","status":"publish","type":"post","link":"http:\/\/dba.qishuo.xin\/?p=1711","title":{"rendered":"MariaDB\u4e4bwith as\u548cupdate\u7528\u6cd5"},"content":{"rendered":"<p>\u5f53\u4f7f\u7528 <code>update<\/code> \u66f4\u65b0\u6570\u636e\u5e76\u4f7f\u7528 <code>with as<\/code> \u8bed\u53e5:<\/p>\n<pre><code class=\"language-sql\">UPDATE sc_accdep x\n   SET x.NamePath = (WITH RECURSIVE depinfo(accdepid,parentid,accdepname,lev,idpath,namepath)\n                       AS (SELECT a.accdepid,\n                                  a.parentid,\n                                  a.accdepname,\n                                  1 AS lev,\n                                  CONCAT('\/', Cast(a.accdepid AS VARCHAR(4000)),'\/') AS idpath,\n                                  CONCAT('\/', a.accdepname,'\/') AS namepath\n                             FROM sc_accdep a\n                            WHERE a.parentid = -1\n                              AND a.epid = 1\n                            UNION ALL\n                           SELECT b.accdepid,\n                                  b.parentid,\n                                  b.accdepname,\n                                  x.lev + 1,\n                                  CONCAT(x.idpath,Cast(b.accdepid AS VARCHAR(4000)),'\/') as idpath,\n                                  CONCAT(x.namepath,b.accdepname,'\/') AS namepath\n                             FROM depinfo x\n                            INNER JOIN (SELECT *\n                                          FROM sc_accdep y\n                                         WHERE y.epid = 1\n                                           AND y.parentid <> -1\n                                       ) b ON x.accdepid = b.parentid)\n                   SELECT substring(y.namepath, 1, char_length(y.namepath) - 1)\n                     FROM depinfo y\n                    WHERE x.AccDepID = y.accdepid)\n WHERE x.EpID = 1;<\/code><\/pre>\n<ul>\n<li>\u9644\uff1a<br \/>\nOracle\u4e4bwith as\u548cupdate\u7528\u6cd5\uff1a<a target=\"_blank\" href=\"http:\/\/dba.qishuo.xin\/?p=343\">http:\/\/dba.qishuo.xin\/?p=343<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u4f7f\u7528 update \u66f4\u65b0\u6570\u636e\u5e76\u4f7f\u7528 with a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,3],"tags":[12,40],"class_list":["post-1711","post","type-post","status-publish","format-standard","hentry","category-mariadb-sql","category-mariadbmysql","tag-mariadb","tag-with-as"],"_links":{"self":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/1711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1711"}],"version-history":[{"count":1,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions"}],"predecessor-version":[{"id":1712,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions\/1712"}],"wp:attachment":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1711"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}