I have a table EMP in which the values will be like this
EmpId Ename Sal DeptId
11 Ram 10000 10
11 Ram 10000 10
22 Raj 20000 20
22 Raj 20000 20
33 Anil 15000 30
33 Anil 15000 30
I want to delete only duplicate Rows. After Delete I want
the output like this
EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30
Answer Posted / guest
WITH T1 AS (
SELECT ROW_NUMBER () OVER ( PARTITION BY EmpId ORDER BY
EmpId) AS RNUM,EmpId FROM EMP)
delete
FROM T1 WHERE RNUM > 1
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Does a specific recovery model need to be used for a replicated database? : sql server replication
What is transaction server isolation?
What are the different types of sub-queries?
What is star, snowflake and star flake schema? : sql server analysis services, ssas
What program is used to store the data source file?
What is bcp? When does it used?
Define clusters?
Explain error and transaction handling in sql server?
in a table is b in column k (manikanta,sivananda,muralidhar) i want result like (mnikanta,sivnanda,murlidhar) please slove it
What to check if a User database is locked?
What does it mean to normalize data?
tell me what is blocking and how would you troubleshoot it? : Sql server database administration
How can we delete a table in sql server?
Explain transaction server auto commit?
Are null values the same as that of zero or a blank space?