如何使用 Orientdb 删除 table 中的重复记录

How to delete duplicate records in a table using Orientdb

Select * from table
cola colb
a     b
a     c
a     b
a     b

如何删除 table.Expected 结果中除第一个条目之外的重复记录:

 Select * from table
cola colb
a     b
a     c

作为解决方法,您可以尝试以下解决方案:
1.新建(临时)class

create class table_temp
  1. 将分组的(不同的)值插入新的 class table

    insert into table_temp from select cola, colb from your_table group by cola, colb

  2. 清理你的tabledelete from your_table

  3. 从新插入数据 table
    insert into your_table from select cola, colb from table_temp group by cola, colb

理想情况下,这些步骤应该在单个事务中完成。

从 your_table 中删除,其中 @rid 不在(select 第一个(列表(@rid))中,来自 your_table group by cola,colb order by @rid)