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 is exporting utility?
What is the use of builtinadministrators group in sql server? : sql server security
What are the reporting services components?
What is multilevel indexing?
How to change the data type of an existing column with "alter table" statements in ms sql server?
What is sql injection? How to protect against sql injection attack?
What is indexing a document?
What is a linked server in sql server?
Explain about SQL server 2005?
how you can move data or databases between servers and databases in sql server? : Sql server administration
What are the types of dml?
Explain cdc and sql injection?
What is 1nf 2nf?
What are data files?
How to call stored procedure using http soap?