What is the SQL query to select, delete and get count of
duplicate rows in DB2?

Answers were Sorted based on User's Feedback



What is the SQL query to select, delete and get count of duplicate rows in DB2?..

Answer / igor kramov

DELETE FROM (
SELECT ROWNUMBER() OVER (PARTITION BY c1, c2 ORDER BY c3
DESC) AS rnum FROM t1)
WHERE rnum > 1 ;

the same is for Select\Count

Is This Answer Correct ?    6 Yes 0 No

What is the SQL query to select, delete and get count of duplicate rows in DB2?..

Answer / hkhatri27

SELECT Columns
FROM Table
GROUP BY Columns
HAVING COUNT(*) > 1;

~ Himanshu

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More DB2 Interview Questions

What DB2 Catalog column tell you when an index needs table reorganized ?

1 Answers  


what are extents?

5 Answers  


What is runstats utility in db2?

0 Answers  


What is UNION,UNION ALL?

2 Answers  


pls tell me abt the normalization five types....

2 Answers  






What Utility is used to migrate DB2 from one release to the next?

1 Answers  


How do I add a column to an existing table in db2?

0 Answers  


DB2: A calls B once sucessfull and second time when it calls says curson is open why is it so?

1 Answers   IBM,


What do you mean by between and in? Is between inclusive of specified range values?

0 Answers  


What is the use of runstats in db2?

0 Answers  


What is DCLGEN ?

3 Answers  


What is the difference between dbm cfg and db cfg file in db2 ?

0 Answers   MCN Solutions,


Categories