Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the SQL query to select, delete and get count of
duplicate rows in DB2?

Answers were Sorted based on User's Feedback



What is the SQL query to select, delete and get count of duplicate rows in DB2?..

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

What is the SQL query to select, delete and get count of duplicate rows in DB2?..

Answer / hkhatri27

SELECT Columns
FROM Table
GROUP BY Columns
HAVING COUNT(*) > 1;

~ Himanshu

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More DB2 Interview Questions

I am getting a error multiple row fetched while executing a Cobol-DB2 program.How can I solve it without using a cursor.

8 Answers  


What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?

0 Answers  


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?

2 Answers  


What is normalization and what are the five normal forms?

1 Answers  


What is db2 bind process?

0 Answers  


What is COPY PENDING status?

6 Answers  


What is db2 purescale?

0 Answers  


when does the SQL statement gets executed when you use cursor in the application programming ?

3 Answers   IBM,


Can we use select query in a loop to fetch multiple rows in a COBOL PROGRAM? If so, what is the advantage of cursor?

1 Answers   UST,


What is image copy in db2?

0 Answers  


What should be specified along with a cursor in order to continue updating process after commit?

1 Answers   IBM,


Which command is used to connect to a database in DB2 ? Give the Syntax.

0 Answers   MCN Solutions,


Categories