我有一个表收入,我要删除所有,但是一行,在“日期”列中具有相同值的行,比如说2016-05-08。有人可以帮忙吗? TIA。
答案 0 :(得分:0)
我会使用行号来执行此操作:
with todelete as (
select i.*, row_number() over (partition by date order by date) as seqnum
from income
)
delete todelete
from todelete
where seqnum > 1;
您可以通过调整order by
子句来控制保留哪个行。