What is the SQL query to select, delete and get count of
duplicate rows in DB2?
Answers were Sorted based on User's Feedback
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 |
Answer / hkhatri27
SELECT Columns
FROM Table
GROUP BY Columns
HAVING COUNT(*) > 1;
~ Himanshu
| Is This Answer Correct ? | 2 Yes | 2 No |
What are bind parameters in db2?
How to find the number of rows in a db2 table?
When do you specify the isolation level?
what is Static and dynamic linking
Is there any advantage to denormalizing DB2 tables?
What is bind and rebind in db2?
What's the difference between DB2 active log and archive log? Thanks a lot...
Following a db2 update statement, what is the quickest way to compute the total number of updated rows?
What is auditing?
How to restart a DB2 program?
What is alias in db2?
ther r 2 tables OTTABLE & SALTABLE, add the otamt from OTTABLE to empsal of SALTABLE if eid is matched else add the unmatched from OTTABLE to SALTABLE