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
how can u get last observation in an unknown dataset ?
Explain how many types of relationship?
Explain a checkpoint?
Is truncate autocommit?
Does an index slow down updates on indexed columns?
Tell me time data type, datetime2, datetimeoffset data type in sql server 2008?
What are the difference between data mart and data warehouse? : sql server analysis services, ssas
Mention the command used to rename the database.
Can you explain various data region available in ssrs with their use?
What is the synonym of join?
Mention the uses of stored procedures.
Please differentiate between a local and a global temporary table?
Explain aggregate functions?
What is snapshot replication?
How to add the custom code in Report?