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
What is a sql join?
What is database dimension? : sql server analysis services, ssas
How do use Having,Group by,Group function in SQL?
What are security principals used in sql server 2005?
What is an example of a foreign key?
How to use values from other tables in update statements in ms sql server?
Does table partitioning improve performance?
What is difference between commit and rollback when used in transactions?
Explain the steps to use transact-sql cursor?
what is a default tcp/ip socket assigned for sql server? : Sql server database administration
what are acid properties? : Sql server database administration
Is it possible in sql table to have more than one foreign key?
To automatically record the time on which the data was modified in a table, which data type should you choose for the column?
Which operator do you use to return all of the rows from one query except rows are returned in a second query?
sql database suspect We have a sql database that is showing as suspect. How can we recover?