How To delete duplicate record from a particular table?
Answer Posted / jagan mohan varma
employee
----------------------------
eid ename sal
----- --------- ------
1 jagan 2000
2 mohan 3000
3 varma 4000
********************************
attendence
-------------------------------
id eid date
----------- ----------- -----------------------
10 1 2010-06-10 00:00:00.000
11 1 2010-06-10 00:00:00.000
12 2 2010-06-10 00:00:00.000
13 2 2010-06-10 00:00:00.000
14 3 2010-06-10 00:00:00.000
15 3 2010-06-10 00:00:00.000
16 3 2010-06-10 00:00:00.000
*************************************************
Deleting duplicate records from attendence table could be:
**********************************************************
delete from attandence
where id not in (
select max(atd.id)
from employee emp
inner join attandence atd
on atd.eid = emp.eid group by atd.eid)
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the essential components of sql server service broker?
what are the different stages of Report Processing?
What is a cube? : sql server analysis services, ssas
What is log cache in sql server?
Where do you find the default Index fill factor and how to change it?
Tell me what are the advantages of using stored procedures?
What are the advantages to use stored procedures?
List the different types of collation sensitivities in sql server?
What is a data collection table?
Can we write trigger for view?
What changes in the front end code is needed if mirroring is implemented for the high availability? : sql server database administration
What are data files?
Does order by actually change the order of the data in the tables or does it just change the output?
What is database mirroring?
can a table be moved to different filegroup? : Sql server administration