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 |
I am getting a error multiple row fetched while executing a Cobol-DB2 program.How can I solve it without using a cursor.
What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?
we can code COPY DCLGEN or INCLUDE DCLGEN, At which stage of the precompilation , dclgen get expanded if we write 1) copy 2) include one question about dclgen.. Is it mandatory to use declare table in dclgen.. I think no...but it will be used by the precompiler to validate the table name,column name etc.., can one clear my doubt ..is it necessary to include declare table or not?
What is normalization and what are the five normal forms?
What is db2 bind process?
What is COPY PENDING status?
What is db2 purescale?
when does the SQL statement gets executed when you use cursor in the application programming ?
Can we use select query in a loop to fetch multiple rows in a COBOL PROGRAM? If so, what is the advantage of cursor?
What is image copy in db2?
What should be specified along with a cursor in order to continue updating process after commit?
Which command is used to connect to a database in DB2 ? Give the Syntax.