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
What are the source of constraints?
Why truncate is ddl?
What is the main purpose of having conversation group?
What stored by the master? : sql server database administration
Define a cross join?
SQL Server Architecture ?
How to handle error or exception in sql?
How many databases Microsoft SQL server provides?
Define tool Manage Statistics in SQL Server 2000 query ?
What is an index. What are the types?
Explain what you mean by 3 tier architecture.
What is amo? : sql server analysis services, ssas
What happens if you are trying to access a schema not owned by you?
hi, the following are the outputs of sp_spaceused and sp_tempdbspace sp_spaceused ------------ database size unallocated size tempdb 77752.95 MB 28026.99 MB sp_tempdbspace ------------- database size spaceused tempdb 77752.945312 1.007812 the unused space in sp_spaceused is nearly 28 Gb and in sp_tempdbspace is nearly 76 Gb cany any one explain about this output and why its giving different results.
Tell me about builtinadministrator?