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 |
What do you understand by a view?
How to add an address record into adventureworkslt?
What are SSL and TSL protocols?
What is meant by datasource?
What is split brain scenario in DB mirroring?
Explain how many normalization forms?
How to see the event list of an existing trigger using sys.trigger_events?
1. How to fetch all the duplicate records from the table. 2. How to fetch the second highest salary from the table.
How to delete exactly duplicate records from a table?
what is the purpose of creating view is sql server 2000
What do you understand by intent locks?
What is the use of placing primary key and foreign key constrains on columns.