I have written a query delete from Table1 where Tableid in(select Tableid from Table1 group by Tableid having count(*) >1) but this query removes all the data having count greater than 1.
Can someone help me with a single line query that deletes the duplicate data and resetting the count to 1.
I have table Table1
with
Tableid Count
1 10
2 2
3 1
4 NULL
5 31
Post Delete it should be
Tableid Count
1 1
2 1
3 1
4 NULL
5 1