With studentCTE As (
Select ROW_NUMBER() Over(Partition BY RNO ORDER By NAME) as RowNumber
from student)
Delete from studentCTE
where RowNumber > 1;
select * from studentCTE;
答案 0 :(得分:0)
如果要从表中删除,则需要以单词DELETE开头。您可以使用查询选择要删除的行,但是查询的每个部分(包括WITH子句)都必须在DELETE之后合并在一起。
delete from student where rowid in (
with cte as (
select ROW_NUMBER() Over(Partition BY RNO ORDER By NAME) as RowNumber,
rowid as rid
from student
)
select rid from cte
where rownumber > 1
);