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 different type of replication in sql server?
Explain the database you used in your final year project?
What is transaction server explicit transaction?
How to find tables without indexes?
what is datawarehouse?
What are the reporting services components?
How check triggers in sql server?
How do you set a trace flag in sql server?
Explain various data region available in ssrs with their use?
How we create SQL Server 2005 Reporting Services ? Give me Sample
What are “lock” hints?
Can a cursor be updated? If yes, how you can protect which columns are updated?
How does using a separate hard drive for several database objects improves performance right away?
What is a filestream?
Differentiate between ms sql server reporting services vs crystal reports?