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 executereader?
What is master database? : SQL Server Architecture
What is mssql?
How to list all tables in the database using odbc_tables()?
what are the Prerequisites for Replication?
Explain the difference between HTTP and HTTPS in database?
Equi join and non equi join is possible with sql server?
Do you know what are the reporting services components?
What is a not null constraint?
What are the differences between left join and inner join in sql server?
What is snapshot report?
What do you mean by a dependent functionality in a build?
What are the advantages of using stored procedures in sql server?
What is resource governor in sql server?
A trigger can reference objects outside the current database? State true or false.