I have a table which looks like this
ID A B C
1 1 0 0
1 1 0 0
2 1 1 0
2 1 1 0
How can I remove the duplicated rows in SQL so that I am left with a table that looks like this:
ID A B C
1 1 0 0
2 1 1 0
I have a table which looks like this
ID A B C
1 1 0 0
1 1 0 0
2 1 1 0
2 1 1 0
How can I remove the duplicated rows in SQL so that I am left with a table that looks like this:
ID A B C
1 1 0 0
2 1 1 0
use row_number()
with cte as
(
select *, row_number() over(partition by id order by id) as rn
from tablename
)
delete from cte where rn<>1