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 is the physical storage length of timestamp data type?
Where do you specify them?
What is correlation names?
What is a db2 table?
What is the difference between using bind () and rebind () methods of naming class?
Why do we need to create an alias if we can directly use the table name? What are the benefits of referring a table name by its alias? Also, when should we go for alias and when for synonyms?
Suppose there are many duplicate records in a Db2 table. What is the query to retrive only duplicate records?
What are db2 error codes -305 and -407. What is the difference between these 2 error codes ?
What is performance tuning db2?
What is the latest version of ibm db2?
Is ibm db2 free?
How do I import a csv file into db2?