How to select the duplicate rows from a table?

Answers were Sorted based on User's Feedback



How to select the duplicate rows from a table?..

Answer / nans

Select FIELD1 From <TABLENAME> As Temp Group By FIELD1 Having
Count(*) >1;

Is This Answer Correct ?    14 Yes 1 No

How to select the duplicate rows from a table?..

Answer / channabasappa

select field name from tablename where group by field name
having count(field name)>1;

Is This Answer Correct ?    1 Yes 0 No

How to select the duplicate rows from a table?..

Answer / mahesh vasudevan

Select <col-name> from table A1 and A2
where A1.Col = A2.Col.

This should be an inner join. Then you are finding the
intersection of the key values...if you want to find the
duplicates for all matching column of the rows code AND
condition for join with all those columns.....by the way
there are different easy ways to find it. but this is one of
the way.

Is This Answer Correct ?    0 Yes 0 No

How to select the duplicate rows from a table?..

Answer / pandu

select distinct from <field name> from <table name>

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More DB2 Interview Questions

i tried to copy some records from microsoft excel to as-400 physical file through "Bosanova" emulation. Out of 14000 records only 12000 records copies and subsequently programe started to hang. Then, i closed the program forcefully. I did' under stand the problem. Also when i try to compile the physical file it is showing as "The file in use". How to overcome this problem?

0 Answers   TATA,


A Table feild is declared as Decimal(7,2). I want to insert the decimal in to this column thru cobol-db2 program. How should I declare my local input file variable or any suggestion?

7 Answers   IBM,


How do you define a correlated name?

1 Answers  


When is the skeleton cursor table created?

1 Answers  


can any one provide me the link for the db2 v7 & db2 v8 manual for Z/os? i need to know about the syntax of REORG in both versions & need to know the difference as well

0 Answers  






Bind concepts in DB2 cobol

10 Answers   IBM, TCS, TRD, Virtusa,


What is a cursor?

2 Answers  


Do we have any optinon to search part of integer in DB2 as we have for character Like,SUBSTR optins?

1 Answers  


i want to maintain uniqueness on pdf without make lf??????????

0 Answers  


when we are tying to update a table having 100 rows. if the program abends when updating 51 row . how to start updating again from the 51 row .what was the logic

2 Answers   TCS,


What is Reorg Recovery? when will you run it?

2 Answers  


What is the difference between primary key & unique index ?

6 Answers   Patni, Temenos,


Categories