{"id":2709,"date":"2020-12-31T15:54:53","date_gmt":"2020-12-31T07:54:53","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=2709"},"modified":"2021-01-27T11:42:13","modified_gmt":"2021-01-27T03:42:13","slug":"gbase-8a%e5%89%94%e9%99%a4%e5%a4%84%e7%90%86%e9%87%8d%e5%a4%8d%e6%95%b0%e6%8d%ae%e7%9a%84%e5%87%a0%e4%b8%aa%e5%8e%bb%e9%87%8d%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/2709","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u5254\u9664\u5904\u7406\u91cd\u590d\u6570\u636e\u7684\u51e0\u4e2a\u53bb\u91cd\u65b9\u6cd5"},"content":{"rendered":"<p>\u6570\u636e\u7531\u4e8e\u6709\u4e9b\u539f\u56e0\u51fa\u73b0\u4e86\u91cd\u590d\uff0c\u6bd4\u5982\u8bef\u64cd\u4f5cinsert\u4e86\u4e24\u884c\uff0c\u6216\u8005\u6570\u636e\u5206\u6279\u5f55\u5165\u8fc7\u7a0b\u4e2d\u610f\u5916\u4e2d\u65ad\u4e86\uff0c\u7ee7\u7eed\u540e\u5f53\u5929\u4e00\u6279\u91cd\u590d\u5f55\u5165\u7b49\u3002\u672c\u6587\u4ecb\u7ecdGBase 8a\u6570\u636e\u5e93\u5728\u5904\u7406\u5254\u9664\u91cd\u590d\u6570\u636e\u7684\u51e0\u4e2a\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p>\u5982\u4e0b\u5148\u7ed9\u51fa\u901a\u7528\u7684\u65b9\u6cd5\uff0c\u5e76\u5bf9\u590d\u5236\u8868\u7ed9\u51fa\u4e00\u79cd\u989d\u5916\u7684\u65b9\u6848\u3002<\/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-6a2b0c868f57e\" 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-6a2b0c868f57e\"  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\/2709\/#%E6%9C%89%E5%94%AF%E4%B8%80ID%E7%9A%84%E6%83%85%E5%86%B5\" >\u6709\u552f\u4e00ID\u7684\u60c5\u51b5<\/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\/2709\/#%E6%B5%8B%E8%AF%95%E6%95%B0%E6%8D%AE\" >\u6d4b\u8bd5\u6570\u636e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E6%95%B0%E6%8D%AE%E8%BD%AC%E5%82%A8%E6%B3%95\" >\u6570\u636e\u8f6c\u50a8\u6cd5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E4%B8%B4%E6%97%B6%E8%A1%A8%E6%B3%95\" >\u4e34\u65f6\u8868\u6cd5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E5%A4%8D%E5%88%B6%E8%A1%A8%E7%89%B9%E6%AE%8A%E6%96%B9%E6%A1%88\" >\u590d\u5236\u8868\u7279\u6b8a\u65b9\u6848<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E5%A4%8D%E5%88%B6%E8%A1%A8%E6%B5%8B%E8%AF%95%E6%95%B0%E6%8D%AE\" >\u590d\u5236\u8868\u6d4b\u8bd5\u6570\u636e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E5%A4%8D%E5%88%B6%E8%A1%A8%E5%8E%BB%E9%87%8D\" >\u590d\u5236\u8868\u53bb\u91cd<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E5%88%86%E5%B8%83%E8%A1%A8%E5%8E%BB%E9%87%8D\" >\u5206\u5e03\u8868\u53bb\u91cd<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E9%9A%8F%E6%9C%BA%E5%88%86%E5%B8%83\" >\u968f\u673a\u5206\u5e03<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#Hash%E5%88%86%E5%B8%83%E8%A1%A8\" >Hash\u5206\u5e03\u8868<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.gbase8.cn\/en\/2709\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9C%89%E5%94%AF%E4%B8%80ID%E7%9A%84%E6%83%85%E5%86%B5\"><\/span>\u6709\u552f\u4e00ID\u7684\u60c5\u51b5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u679c\u6570\u636e\u6709\u552f\u4e00\u5217\uff0c\u4e0d\u91cd\u590d(\u6bd4\u5982\u81ea\u589e)\uff0c\u90a3\u4e48\u53ef\u4ee5\u76f4\u63a5\u5220\u9664\u3002\u6bd4\u5982\u6709id\u5217 a,b,c \u91cd\u590d<\/p>\n\n\n\n<p>Delete&nbsp; from table&nbsp; where id not in (select max (id) from table group a,b,c)<\/p>\n\n\n\n<p><span class=\"has-inline-color has-luminous-vivid-orange-color\"><strong>\u540e\u9762\u90fd\u662f\u65e0\u552f\u4e00ID\u7684\u60c5\u51b5\u3002<\/strong><\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E6%95%B0%E6%8D%AE\"><\/span>\u6d4b\u8bd5\u6570\u636e<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u4e0b\u6784\u9020\u51e0\u884c\u6570\u636e\u5305\u542b\u91cd\u590d\u7684\u3002\u5176\u4e2d\u6211\u4eec\u5047\u5b9aid\u662f\u53ef\u4ee5\u552f\u4e00\u533a\u5206\u7684\u5b57\u6bb5\uff0c\u53ea\u662f\u91cd\u590d\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table tc1 (id int, name varchar(100));\nQuery OK, 0 rows affected (Elapsed: 00:00:00.60)\n\ngbase&gt; insert into tc1 values (1,'111');\nQuery OK, 1 row affected (Elapsed: 00:00:00.40)\n\ngbase&gt; insert into tc1 values (1,'111');\nQuery OK, 1 row affected (Elapsed: 00:00:00.25)\n\ngbase&gt; insert into tc1 values (2,'222');\nQuery OK, 1 row affected (Elapsed: 00:00:00.40)\n\ngbase&gt; insert into tc1 values (3,'333');\nQuery OK, 1 row affected (Elapsed: 00:00:00.22)\n\ngbase&gt;\ngbase&gt; select * from tc1;\n+------+------+\n| id   | name |\n+------+------+\n|    1 | 111  |\n|    1 | 111  |\n|    2 | 222  |\n|    3 | 333  |\n+------+------+\n4 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%95%B0%E6%8D%AE%E8%BD%AC%E5%82%A8%E6%B3%95\"><\/span>\u6570\u636e\u8f6c\u50a8\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6b64\u65b9\u6cd5\u64cd\u4f5c\u903b\u8f91\u6700\u7b80\u5355\u3002\u672c\u65b9\u6848\u5904\u7406\u903b\u8f91\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>1\u3001\u65b0\u5efa\u4e00\u4e2a\u8868<br>2\u3001\u4f7f\u7528 insert into \u65b0\u8868 as select distinct * from\u8001\u8868\u6765\u53bb\u91cd\uff0c<br>3\u3001drop\u8001\u7684\u8868<br>4\u3001\u5c06\u65b0\u8868\u6539\u540drename\u6210\u8001\u8868\u3002<\/p>\n\n\n\n<p>\u6b64\u65b9\u6cd5\u9002\u5408<br>1\u3001<span class=\"has-inline-color has-luminous-vivid-orange-color\">\u6781\u5c11\u91cf\u6570\u636e<\/span>\uff0c\u6bd4\u5982\u51e0\u767e\u884c\uff0c\u51e0\u73a9\u884c\u7ea7\u522b\u7684\u914d\u7f6e\u8868\uff0c\u7ef4\u5ea6\u8868\u7b49\uff1b<br>2\u3001\u5927\u91cf\u91cd\u590d\u6570\u636e\uff0c\u6bd4\u5982\u8d85\u8fc730%\u7684\u91cd\u590d\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u6570\u636e\u91cf\u5c11\uff0c\u53ef\u4ee5\u5728\u51e0\u79d2\u5185\u5904\u7406\u5b8c\u6210\u3002\u540c\u65f6\u8868\u6570\u636e\u53d8\u52a8\u9891\u7387\u53ef\u63a7\uff0c<span class=\"has-inline-color has-luminous-vivid-orange-color\">\u4e0d\u8981\u51fa\u73b0\u6570\u636e\u4e22\u5931<\/span>\uff08insert \u540e\u53ef\u80fd\u539f\u59cb\u8868\u53c8insert\u7684\u65b0\u6570\u636e\uff0c\u5207\u6362\u8868\u4f1a\u5bfc\u81f4\u6570\u636e\u4e22\u5931)\u7684\u524d\u63d0\u4e0b\u3002<\/p>\n\n\n\n<p>\u5982\u6570\u636e\u53d8\u52a8\u4e0d\u53ef\u63a7\uff0c\u8bf7\u4e0d\u8981\u4f7f\u7528\u6b64\u65b9\u6848\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table tc2 as select distinct * from tc1;\nQuery OK, 3 rows affected (Elapsed: 00:00:00.80)\n\ngbase&gt; select * from tc2;\n+------+------+\n| id   | name |\n+------+------+\n|    1 | 111  |\n|    2 | 222  |\n|    3 | 333  |\n+------+------+\n3 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%B8%B4%E6%97%B6%E8%A1%A8%E6%B3%95\"><\/span>\u4e34\u65f6\u8868\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6b64\u65b9\u6cd5\u9002\u5408\u5904\u7406\u6240\u6709\u573a\u666f\uff0c\u4f46\u5982\u679c\u7edd\u5927\u90e8\u5206\u90fd\u662f\u91cd\u590d\u6570\u636e\u5e93\uff0c\u6027\u80fd\u4e0a\u4e0d\u5982\u65b9\u6cd51\u7684\u91cd\u5efa\u65b9\u6848\u3002<\/p>\n\n\n\n<p>\u5904\u7406\u903b\u8f91\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>1\u3001\u5c06\u91cd\u590d\u6570\u636einsert\u5230\u4e00\u4e2a\u4e34\u65f6\u8868<br>2\u3001\u5c06\u91cd\u590d\u6570\u636e\u4ece\u539f\u59cb\u8868\u5220\u9664<br>3\u3001\u5c06\u4e34\u65f6\u8868\u6570\u636einsert\u5230\u6b63\u5f0f\u8868<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table tc3 as select * from tc1 group by id,name having count(*) &gt;1;\nQuery OK, 1 row affected (Elapsed: 00:00:00.65)\n\ngbase&gt; select * from tc3;\n+------+------+\n| id   | name |\n+------+------+\n|    1 | 111  |\n+------+------+\n1 row in set (Elapsed: 00:00:00.00)\n\ngbase&gt; delete tc1 where id in (select id from tc3) ;\nQuery OK, 2 rows affected (Elapsed: 00:00:00.57)\n\ngbase&gt; select * from tc1;\n+------+------+\n| id   | name |\n+------+------+\n|    2 | 222  |\n|    3 | 333  |\n+------+------+\n2 rows in set (Elapsed: 00:00:00.00)\n\ngbase&gt; insert into tc1 select * from tc3;\nQuery OK, 1 row affected (Elapsed: 00:00:00.49)\nRecords: 1  Duplicates: 0  Warnings: 0\n\ngbase&gt; select * from tc1;\n+------+------+\n| id   | name |\n+------+------+\n|    1 | 111  |\n|    2 | 222  |\n|    3 | 333  |\n+------+------+\n3 rows in set (Elapsed: 00:00:00.01)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%A4%8D%E5%88%B6%E8%A1%A8%E7%89%B9%E6%AE%8A%E6%96%B9%E6%A1%88\"><\/span>\u590d\u5236\u8868\u7279\u6b8a\u65b9\u6848<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u590d\u5236\u8868\uff0c\u56e0\u4e3a\u6bcf\u4e2a\u8282\u70b9\u7684\u6570\u636e\u5b8c\u5168\u4e00\u81f4\uff0c\u5305\u62ec\u987a\u5e8f\uff0c\u6240\u4ee5\u53ef\u4ee5\u7528rowid\u6765\u5220\u9664\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%A4%8D%E5%88%B6%E8%A1%A8%E6%B5%8B%E8%AF%95%E6%95%B0%E6%8D%AE\"><\/span>\u590d\u5236\u8868\u6d4b\u8bd5\u6570\u636e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table tcc1 (id int, name varchar(100))replicated;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.48)\n\ngbase&gt; insert into tcc1 values(1,'1111');\nQuery OK, 1 row affected (Elapsed: 00:00:00.68)\n\ngbase&gt; insert into tcc1 values(1,'1111');\nQuery OK, 1 row affected (Elapsed: 00:00:00.36)\n\ngbase&gt; insert into tcc1 values(2,'2222');\nQuery OK, 1 row affected (Elapsed: 00:00:00.33)\n\ngbase&gt; insert into tcc1 values(3,'3333');\nsQuery OK, 1 row affected (Elapsed: 00:00:00.48)\n\ngbase&gt; select * from tcc1;\n+------+------+\n| id   | name |\n+------+------+\n|    1 | 1111 |\n|    1 | 1111 |\n|    2 | 2222 |\n|    3 | 3333 |\n+------+------+\n4 rows in set (Elapsed: 00:00:00.00)\n\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%A4%8D%E5%88%B6%E8%A1%A8%E5%8E%BB%E9%87%8D\"><\/span>\u590d\u5236\u8868\u53bb\u91cd<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u901a\u8fc7\u5982\u4e0b\u7684\u65b9\u6cd5\uff0c\u5f97\u5230\u91cd\u590d\u6570\u636e\u7684rowid\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; select min(rowid),id from tcc1 group by id having count(*)&gt;1;\n+------------+------+\n| min(rowid) | id   |\n+------------+------+\n|          0 |    1 |\n+------------+------+\n1 row in set (Elapsed: 00:00:00.02)\n<\/code><\/pre>\n\n\n\n<p>\u901a\u8fc7\u5173\u8054\u5220\u9664\u53bb\u91cd\uff0c\u529f\u80fd\u7ec6\u8282\u770b\u540e\u9762\u53c2\u8003\u90e8\u5206\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; delete tcc1 from tcc1,(select min(rowid)minrowid,id from tcc1 group by id having count(*)&gt;1)tmp where tmp.id=tcc1.id and tcc1.rowid&gt;minrowid;\nQuery OK, 1 row affected (Elapsed: 00:00:00.49)\ngbase&gt; select * from tcc1;\n+------+------+\n| id   | name |\n+------+------+\n|    1 | 1111 |\n|    2 | 2222 |\n|    3 | 3333 |\n+------+------+\n3 rows in set (Elapsed: 00:00:00.01)\n\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%86%E5%B8%83%E8%A1%A8%E5%8E%BB%E9%87%8D\"><\/span>\u5206\u5e03\u8868\u53bb\u91cd<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u679cHash\u5206\u5e03\u8868\uff0c\u53ef\u4ee5\u901a\u8fc7\u7c7b\u4f3c\u590d\u5236\u8868\u7684\u65b9\u6848\u8fdb\u884c\u53bb\u91cd\u3002\u5176\u6838\u5fc3\u662f\u76f8\u540chash\u5217\u7684\u6570\u636e\uff0c\u90fd\u5728\u4e00\u4e2a\u5206\u7247\u91cc\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%9A%8F%E6%9C%BA%E5%88%86%E5%B8%83\"><\/span>\u968f\u673a\u5206\u5e03<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u76f8\u540c\u7684id\uff0c\u6709\u91cd\u590d\u7684rowid,\u6240\u4ee5\u4e0d\u80fd\u5220\u9664\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table tccc1(id int, name varchar(100));\nQuery OK, 0 rows affected (Elapsed: 00:00:00.48)\n\ngbase&gt;\ngbase&gt; load data infile 'sftp:\/\/gbase:gbase1234@10.0.2.201\/home\/gbase\/tc.txt' into table tccc1 fields terminated by ',';\nQuery OK, 4 rows affected (Elapsed: 00:00:01.03)\nTask 3080235 finished, Loaded 4 records, Skipped 0 records\n\ngbase&gt; select rowid, t.* from tccc1 t;\n+-------+------+------+\n| rowid | id   | name |\n+-------+------+------+\n|     0 |    1 | 1111 |\n|     1 |    2 | 2222 |\n|     0 |    1 | 1111 |\n|     1 |    3 | 3333 |\n+-------+------+------+\n4 rows in set (Elapsed: 00:00:00.02)\n\ngbase&gt; select rowid, t.* from tccc1 t order by id;\n+-------+------+------+\n| rowid | id   | name |\n+-------+------+------+\n|     0 |    1 | 1111 |\n|     0 |    1 | 1111 |\n|     1 |    2 | 2222 |\n|     1 |    3 | 3333 |\n+-------+------+------+\n4 rows in set (Elapsed: 00:00:00.08)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Hash%E5%88%86%E5%B8%83%E8%A1%A8\"><\/span>Hash\u5206\u5e03\u8868<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u76f8\u540c\u7684id,\u5176rowid\u662f\u4e0d\u540c\u7684\uff0c\u4e0d\u4f1a\u91cd\u590d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table tccc2(id int, name varchar(100))distributed by ('id');\nQuery OK, 0 rows affected (Elapsed: 00:00:00.40)\n\ngbase&gt; load data infile 'sftp:\/\/gbase:gbase1234@10.0.2.201\/home\/gbase\/tc.txt' into table tccc2 fields terminated by ',';\nQuery OK, 4 rows affected (Elapsed: 00:00:00.90)\nTask 3080237 finished, Loaded 4 records, Skipped 0 records\n\ngbase&gt; select rowid, t.* from tccc2 t order by id;\n+-------+------+------+\n| rowid | id   | name |\n+-------+------+------+\n|     1 |    1 | 1111 |\n|     0 |    1 | 1111 |\n|     2 |    2 | 2222 |\n|     3 |    3 | 3333 |\n+-------+------+------+\n4 rows in set (Elapsed: 00:00:00.05)\n<\/code><\/pre>\n\n\n\n<p>\u53bb\u91cd<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; delete tccc2 from tccc2,(select min(rowid)minrowid,id from tccc2 group by id having count(*)&gt;1)tmp where tmp.id=tccc2.id and tccc2.rowid&gt;minrowid;\nQuery OK, 1 row affected (Elapsed: 00:00:00.30)\n\ngbase&gt; select rowid, t.* from tccc2 t order by id;                                                                                +-------+------+------+\n| rowid | id   | name |\n+-------+------+------+\n|     0 |    1 | 1111 |\n|     2 |    2 | 2222 |\n|     3 |    3 | 3333 |\n+-------+------+------+\n3 rows in set (Elapsed: 00:00:00.07)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-\u8001\u7d2b\u7af9\u7684\u5bb6 wp-block-embed-\u8001\u7d2b\u7af9\u7684\u5bb6\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"MJGAYCOr6Y\"><a href=\"https:\/\/www.gbase8.cn\/en\/1771\/\">GBase 8a\u591a\u8868\u5173\u8054\u5220\u9664delete join<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"\u300aGBase 8a\u591a\u8868\u5173\u8054\u5220\u9664delete join\u300b\u2014\u8001\u7d2b\u7af9\u7684\u5bb6\" src=\"https:\/\/www.gbase8.cn\/1771\/embed#?secret=MJGAYCOr6Y\" data-secret=\"MJGAYCOr6Y\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>","protected":false},"excerpt":{"rendered":"<p>\u6570\u636e\u7531\u4e8e\u6709\u4e9b\u539f\u56e0\u51fa\u73b0\u4e86\u91cd\u590d\uff0c\u6bd4\u5982\u8bef\u64cd\u4f5cinsert\u4e86\u4e24\u884c\uff0c\u6216\u8005\u6570\u636e\u5206\u6279\u5f55\u5165\u8fc7\u7a0b\u4e2d\u610f\u5916\u4e2d\u65ad\u4e86\uff0c\u7ee7\u7eed\u540e\u5f53\u5929\u4e00\u6279\u91cd\u590d\u5f55\u5165\u7b49\u3002\u672c\u6587\u4ecb\u7ecdGBase 8a\u6570\u636e\u5e93\u5728\u5904\u7406\u5254\u9664\u91cd\u590d\u6570\u636e\u7684\u51e0\u4e2a\u65b9\u6cd5\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2709","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2709","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=2709"}],"version-history":[{"count":17,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2709\/revisions"}],"predecessor-version":[{"id":3817,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2709\/revisions\/3817"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=2709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=2709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=2709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}