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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ashim kumar pal
SET rowcount 3
delete distinct * from table
set rowcount 0
select * from table
| Is This Answer Correct ? | 0 Yes | 4 No |
How many types of stored procedures are there in sql server?
What is difference between table aliases and column aliases? Do they affect performance?
How do I start sql server agent automatically?
Tell me what is sql profiler?
What are the database objects? : SQL Server Architecture
Explain about system stored procedure?
What is cursors?
If a stored procedure is taking a table data type, how it looks?
How to turn off warning messages during php execution?
What is resource governor?
What is a trigger and its types?
What is ms sql server reporting services?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)