if 3 duplicate records in a table,i want to delete 2 duplicate
records by keeping 1 as it is,how?
Answer Posted / venkat
if u r table like this
sno sname fee
1 a 1000
1 a 1000
2 b 1000
2 b 1000
3 c 1000
3 c 1000
--- write this
with duplicatecte
as
(select row_number()over(partition by sno,sname order by fee
)as rnum from students )
delete from dupcte where rnum>1
---run this query
select * from students
--out put is
1 a 1000
2 b 1000
3 c 1000
this is correct
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What's the information that can be stored inside a bit column?
what is isolation level at dead lock?
What is store procedure? When do you use?
Please explain what is “asynchronous” communication in sql server service broker?
Difference between DELETE and TRUNCATE?
What is difference between count (*) and count column?
What is field with example?
Do you know what is user defined datatypes and when you should go for them?
What is the language structure to add a record to a table?
Define cross join in sql server joins?
What is openrowset sql server?
What is the New in SQL server 2008?
Tell me about normalization in DBMS.
What does it mean to be in union?
What are the various Operating system files that every SQL server 2005 database has and what is the purpose.