如何在psql中使用row_number从表中删除重复项?

问题描述

我编写了以下查询,我正在使用greenplum db和dbeaver进行实施。

with cte as 
(select 
*,row_number() over(partition by first_name order by roll_num) row_num 
from table_name 
where roll_num in ('0011')) 
delete from cte where row_num>1;

以上查询返回错误。有人可以帮我吗!

解决方法

如何?

PostgreSQL DELETE statement with USING clause

参考:PostgreSQL Docs

,

请尝试这样对我有用:

<a title = "Wins" href='results.php? >