Need a sql query: retrive all duplicate records in table

Answers were Sorted based on User's Feedback



Need a sql query: retrive all duplicate records in table..

Answer / chiranjeevi ch

let us assume we have some duplicate records in sample table
and we can identify duplicates with eid.

The the query looks like this.

Select * from sample
where eid=any
(select eid from sample having count(eid)>1 group by eid);

Note: This should be used SQl .. but i never tried in as400
when ever it is necessary means i use following sql
statement in as400 .......

select * from sample where eid=111

it displays all duplicate records related to 111

Is This Answer Correct ?    7 Yes 1 No

Need a sql query: retrive all duplicate records in table..

Answer / kusum

For duplicate records retrieval::::

Select * from employee a where rrn(employee) > (select
min(rrn(employee)) from employee b where a.empno = b.empno)

Is This Answer Correct ?    4 Yes 0 No

Need a sql query: retrive all duplicate records in table..

Answer / sbakshi4

File name : FLNM
Field name : FLD

Query :
SELECT FLD ,COUNT(*) FROM FLNM GROUP BY FLD HAVING COUNT(*) > 1

This will give the field values repeatation with the number of times it is been duplicated.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More RPG400 Interview Questions

Can a indexed file be accessed in arrival sequence in RPG?

1 Answers  


Hi guys. Im in AS/400(RPGLE,CLP) from last 1 year.Now i wan to upgrade my Knowledge in AS/400. Suggest me some new fields & courses which falls under AS/400. Waiting for your quick Response.

1 Answers   Voltech,


When PGMA calls PGMB for the first time PGMB executes the *INZSR. PGMB uses the RETRN operation to return to PGMA. When PGMA call PGMB the second time is the *INZSR executed?

5 Answers   Mphasis,


list down and describe the sub systems vailable

5 Answers   IBM,


i hav 2 logical files(L1,L2) both r derived from one physical file(P1). how can i use both the logical files in one RPG program? if yes what i have to d.

5 Answers   TCS,


why we do STRSRVJOB in batch debugging in as400

1 Answers  


I have a RPG program of 100 Lines and first line is to SETON indicator LR. Will the program execute rest of the 99 Lines?

6 Answers  


Can somebody tell me that, Is it possible to read all the member of PF without OVRDBF?

6 Answers  


wat is the difference between dataarea and data queue?

5 Answers   Airtel, Four soft, Shahi Exports,


1) How to declare a file? 2) How to define a display file? 3) How to monitor error messages in RPG? 4) How to find the attributes for subfiles? and what is the DDS for subfiles?

2 Answers   TCS,


What is the difference Return and InLr?

3 Answers  


I want to declare the number of elements of an array dynamically in RPGLE ? Is it possible? If yes, then how do I do it ?

2 Answers  


Categories