Catch是,整行是一样的.
表:
Hello
Hello
Hello
Bye
Bye
Good Morning
Good Morning
Run Code Online (Sandbox Code Playgroud)
我想离开:
Hello
Bye
Good Morning
Run Code Online (Sandbox Code Playgroud)
我知道你可以在这里使用RANK(),但我从未真正使用它,所以我不太确定.
任何人都可以帮我一把吗?
您可以使用row_number()然后删除表中没有行号1的所有内容:
;with cte as
(
select col,
row_number() over(partition by col order by col) rn
from yourtable
)
delete
from cte
where rn > 1;
Run Code Online (Sandbox Code Playgroud)