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 is ms sql server reporting services?
How the authentication mode can be changed?
Is oracle faster than sql server?
What is the default server name for sql server?
You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?
Describe the functionalities that views support.
What is a dbms wizard?
How do you make a trace?
What is normalization? Describe its different types.
What is an example of a primary key?
What are types of scd? : sql server analysis services, ssas
How to drop an existing schema in ms sql server?
How do I completely remove sql server instance?
What are views used for?
What is not null constraint?