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
Your table has a large character field there are queries that use this field in their search clause what should you do?
Can sql server 2016 run on windows 7?
What happens if the update subquery returns no rows in ms sql server?
What is explicit mode in sql server?
What are filegroups in sql server?
What is BLOCK statements in SQL?
What are the various editions of sql server 2017 that are available in the market?
What is row_number function?
What does set rowcount do?
What are the two authentication modes in sql server?
What is difference between joins and subqueries?
How to test values returned by a subquery with the in operator?
Which table keeps the locking information?
How to edit table in sql server 2017?
If I delete a template from the list in sql studio, will it be deleted from the hard disk? : sql server management studio