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 cascade rule and how does it relate to deletions made with a subselect?
How can you split a table in to exactly half?
What is null in db2?
Where besides the DB2 catalog is database object information stored by DB2?
What are some characteristics of columns that benefit from indexes?
What is dbrm? What it contains? When it will be created?
what are the max. & min. no. of partitions allowed in a partition tablespace?
can we view the access paths created by dbrm ? how ? thx
Can DASD types assigned to storage groups be intermixed (i.e., 3350s and 3380s)?
how to resolve -818 error. how to see timestamp token in load module and plan
how to resolve -805. give clear explination for that
I understand Join always perform better than subqueries. Then what is the advantage/use of Subqueries/correlated subqueries etc.,in DB2 programming.Please explain.