{"id":1999,"date":"2020-11-17T09:25:35","date_gmt":"2020-11-17T01:25:35","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=1999"},"modified":"2020-11-17T09:25:35","modified_gmt":"2020-11-17T01:25:35","slug":"gbase-8a-%e9%80%92%e5%bd%92%e6%9f%a5%e8%af%a2start-with-connect-by-%e6%8a%a5%e9%94%99-from-clause-of-hierarchical-query-can-only-include-one-replicated-table","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/1999","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a \u9012\u5f52\u67e5\u8be2Start with connect by \u62a5\u9519 FROM clause of hierarchical query can only include one replicated table."},"content":{"rendered":"<p>GBase 8a \u6570\u636e\u5e93\u96c6\u7fa4\u652f\u6301\u9012\u5f52\u67e5\u8be2\uff0c\u4f46\u8981\u6c42\u5176\u5fc5\u987b\u662f\u590d\u5236\u8868\uff0c\u5426\u5219\u62a5\u9519\u3002ERROR 1149 (42000): (GBA-02SC-1001) FROM clause of hierarchical query can only include one replicated table.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2aa7cba7a7a\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2aa7cba7a7a\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/1999\/#%E6%8A%A5%E9%94%99%E6%A0%B7%E4%BE%8B\" >\u62a5\u9519\u6837\u4f8b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/1999\/#%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\" >Solution<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%8A%A5%E9%94%99%E6%A0%B7%E4%BE%8B\"><\/span>\u62a5\u9519\u6837\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> show create table t2;\n+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Table | Create Table                                                                                                                                                                                             |\n+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| t2    | CREATE TABLE \"t2\" (\n  \"id\" int(11) DEFAULT NULL,\n  \"name\" varchar(100) DEFAULT NULL,\n  \"pid\" int(11) DEFAULT NULL\n) ENGINE=EXPRESS DISTRIBUTED BY('id') DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |\n+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n1 row in set (Elapsed: 00:00:00.00)\n\ngbase> select * from t2;\n+------+-----------+------+\n| id   | name      | pid  |\n+------+-----------+------+\n|    1 | First     |    0 |\n|    2 | Fist_1    |    1 |\n|    3 | First_2   |    1 |\n|    4 | First_1_1 |    2 |\n+------+-----------+------+\n4 rows in set (Elapsed: 00:00:00.01)\n\ngbase> select * from t2 connect by pid=prior id start with pid=0;\nERROR 1149 (42000): (GBA-02SC-1001) FROM clause of hierarchical query can only include one replicated table.\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\"><\/span>Solution<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6539\u6210\u590d\u5236\u8868<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> create table t3 replicated as select * from t2;\nQuery OK, 4 rows affected (Elapsed: 00:00:00.14)\n\ngbase> select * from t3 connect by pid=prior id start with pid=0;\n+------+-----------+------+\n| id   | name      | pid  |\n+------+-----------+------+\n|    1 | First     |    0 |\n|    2 | Fist_1    |    1 |\n|    4 | First_1_1 |    2 |\n|    3 | First_2   |    1 |\n+------+-----------+------+\n4 rows in set (Elapsed: 00:00:00.02)\n<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a \u6570\u636e\u5e93\u96c6\u7fa4\u652f\u6301\u9012\u5f52\u67e5\u8be2\uff0c\u4f46\u8981\u6c42\u5176\u5fc5\u987b\u662f\u590d\u5236\u8868\uff0c\u5426\u5219\u62a5\u9519\u3002ERROR 1149 (42000): (GBA-02SC-1001) FROM clause of hierarchical query can only include one replicated table.<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-1999","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=1999"}],"version-history":[{"count":1,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1999\/revisions"}],"predecessor-version":[{"id":2000,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1999\/revisions\/2000"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=1999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=1999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=1999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}