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

When a COBOL-DB2 program in PRODUCTION is updating main tables and gone for long run, what have to do?

3118


Explain how can you do the explain of a dynamic sql statement?

649


Is the primary key a clustered index?

609


If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?

702


List some fields from sqlca?

611






What is db2 instance?

590


What is a collection in db2?

579


Mention the downsides of page level lock.

707


What is null in db2?

573


How does cobol compile db2 program?

608


what are bind concepts in db2 cobol?

649


Which isolation level provides highest data integrity?

598


What is catalog database in db2?

644


What is host variable?

594


Is ibm db2 open source?

586