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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to check last update on table in db2?

610


What is the purpose of rollback and commit?

572


What is db2 catalog database?

558


What does reorg do in db2?

551


What is the difference between spufi and qmf?

618






What is plan in cobol db2?

564


What is runstats utility in db2?

544


How to check sequence on a table in db2?

582


How to fetch the last row from the table in SQL (db2)?

1008


What is difference between alias and synonym in db2?

615


What is the difference between db2 and oracle?

646


How to create backup table in db2?

628


What is scrollable cursor in db2?

566


Why do we use cursor?

569


Before you give the explain statement, what are the prerogatives?

558