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 to execute a sql statement using mssql_query()?
What are out-of-range errors with date and time literals?
Tell me what is a linked server?
How to select some specific rows from a table in ms sql server?
what is a check constraint?
How do I open port 1433?
Do you know what is openxml in sql server?
What is BCP? When does it used in sql server 2012?
0 Answers TryTechnicals Pvt Ltd,
How many types of TRIGGERS are there in MS SQL Server?
8 Answers CarrizalSoft Technologies, TCS, United Healthcare,
What is the difference between value type and reference type?
wat wil hapn if we give the both read and deny read permission to user?
Explain the third normal form(3nf)?
Oracle (3259)
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)