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 / shankar
Delete FROM EMP where EMPID in (Select max(EMPID) from EMP
Group by EMPID having Count(EMPID)>1)
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the use of sign function?
What happens if null values are involved in datetime operations?
Explain transaction server explicit transaction?
Explain system functions or built-in functions? What are different types of system functions?
Can sub report data source be different from that of the parent report?
How do you drop an index?
What guidelines should be followed to help minimize deadlocks?
You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?
Is it possible to create trigger on views?
What are the types of stored procedures in an sql server?
When we should use and scope of @@identity?
What are click through reports?
What is difference between index seek vs. Index scan?
Mention a few common trace flags used with sql server?
Explain the disadvantages/limitation of the cursor?