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 can a database be repaired?
SQL Server Performance Tuning for Stored Procedures & reducing debugging time?
1 Answers CarrizalSoft Technologies,
Does transparent data encryption provide encryption when transmitting data across the network?
What is RMS migrations?
Explain timestamp datatype?
What are the steps to process a single select statement?
How to retrieve error messages using mssql_get_last_message()?
How to insert stored procedure result into temporary table?
What is dknf in normalization form?
what are questions asked in TCS for database tester (sqlserver)for 2-3 exp?
Which command using Query Analyzer will give you the version of SQL server and operating system?
Difference between Triggers and Stored Procedure
23 Answers Claimat, HCL, Protech, Silgate,
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)