if 3 duplicate records in table,i want to delete 2 alternating
duplicate records by keeping 1 duplicate and 1 original as it
is,how?
Answer Posted / sivam
sno sname salary
1 aaa 1000
1 aaa 1000
2 bbb 2000
2 bbb 2000
2 bbb 2000
1 aaa 1000
;with aa as
(
select sname,salary,ROW_NUMBER()over(partition by sno,sname,salary order by sno,sname,salary) as Nos from #testtable
)
delete from aa where Nos%2<>0
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Where is localdb stored?
What is subreport?
What do you mean by tablesample?
Explain triggers?
Define inner join in sql server joins?
Explain cdc and sql injection?
What is the difference between a function and a stored procedure?
What is sql profiler. What are the default templates with it? : sql server database administration
What are the key configuration files for sql server reporting services ?
Can we run Reporting Services with SQL Server express edition, which is a free version of SQL Server?
How to get @@error and @@rowcount at the same time?
What is the osql utility?
Does a server store data?
What specific conditions database should meet, before you can bulk copy data into it using bcp?
how do you determine the Load performance of any query in sql server {example how do u determine performance of a select stmnt which returns Dynamically many no of records ... some times 100,1000,10000 etc., }