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
Explain Capacity planning to create a database? and how to monitor it?
What does the on delete cascade option do?
Explain what is log shipping?
How to find table changes in sql server?
What is self join in sql server joins?
Why is replication required on the sql server?
What is data compression? : sql server database administration
Mention the different types of triggers?
How do you troubleshoot errors in a SQL Server Agent Job?
What are the main differences between #temp tables and @table variables and which one is preferred?
Define magic tables in sql server?
Explain Geography datatype in SQL Server
What is an indexed view?
how to define testing of network layers? : Sql server database administration
where the connection string store in the database