How to retrieve duplicate rows in a table?
How to delete the duplicate entries in a table?

Answer Posted / lince thomas

it is very simple,,below
------------------------
select * from(
select row_number() over(partition by empname order by
empname)as rno,empname,salary from Emp1Pay)T
where T.rno>1


delete from Emp1Pay where empid=
(select empid from(select row_number() over(partition by
empname order by empname)as rno,empid
from Emp1Pay )T where T.rno>1)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data source object?

551


Explain boyce and codd normal form(bcnf)?

535


What is bit data type?

622


What is a mutating table error and how can you get around it?

536


What is sql server 2000 work load governor?

556






query processing

1736


Do you know nested transaction?

510


How to optimize stored procedures in sql server?

632


How to convert numeric expression data types using the cast() function?

542


What is bcnf normalization form?

665


What is the use of floor function in sql server?

549


What does normalization do to data?

545


Can we delete data from a view?

544


What is the difference between index seek vs. Index scan?

580


Explain the use of keyword with encryption. Create a store procedure with encryption?

539