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 |
Can any one tell me about Restart logic in DB2.
In a single table,How to retrieve a employee-id of an employee who works in more than one department?
How can you count the number of rows from a table tab?
What is ibm db2 client?
How to find last record before record through SQLRPGLE?
Explain about rct in db2?
What is commit in db2?
AGGREGATE function support by DB2. A) SUM & AVG B) SUM, MIN & AVG C) SUM, MAX, AVG , MIN &COUNT D) NONE
Name the lockable units in DB2?
What is an alias and how does it differ from a synonym?
If a non-DB2 program calls a DB2 program, the calling program's name will be there in SYSIN of IKJEFT01 and the plan name will be that of the called program. But is a bind needed or a plan has to be created for the non-DB2 program also?
Parm value passed is PARM=(10,20). how do code linkage section and how would you add these two passes values and show result in cobol program.