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
In one interview...interviewer ask me question pleas tell me sql server architecture.. can any body tell me the sql server architecture with digram
Are semicolons required at the end of sql statements in sql server 2005?
What it means to be triggered?
What is Extended user-defined?
What are group functions in query statements in ms sql server?
How can we check the sql server version?
How will you optimize a stored procedure optimization?
Tell me what is sql profiler?
What xml support does the sql server extend?
How do I start sql server agent automatically?
What are the two modes of authentication in sql server?
How can we improve performance by using SQL Server profiler?
How to copy data from one table to another table?
What is the difference between SQL notification and SQL invalidation?
ow to bring suspect mode datbase online from scratch