delete from xxxx a
where a.ctid = any(
array (
select ctid from (
select row_number() over (partition by dnportid),
ctid
from xxxx) t
where row_number > 1
)
);
pgsql 删除任意重复行
于 2023-03-30 15:45:29 首次发布
该SQL语句用于从表xxxx中删除特定行,它使用了CTID作为主键标识,并通过子查询选择了行号大于1的dnportid分区。子查询利用row_number()函数对每个dnportid分区进行编号,并选取除第一行外的所有行。
2092

被折叠的 条评论
为什么被折叠?



