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

i have 6 char field in program, but this field is using in all files i want to chage field size as 10 char , how can i do this except using *like defn...?

1 Answers   IBM,


What is the diff bw PF/LF Name and their Record format name? what is restriction in record format then file name?

0 Answers   Wipro,


how to convert date format from one format to another i think in CL/400 its CVTDAT,Please tell in RPG/400 sir not in RPGILE

3 Answers   iGate,


How can we make use of SETLL operation in CL?

11 Answers  


what is the necessary keyword needed to scroll subfile records?

0 Answers   IBM,






1.Suppose my file has 10 fields and I want to make the 2nd field Zeros in all records. And assume I have millions of records and I dont want to read each record and update the desired field with 0. Any other way to do this in one step operation? 2. Assume my file has 100 records and I want to see only first 10 records. Is this possible through LF? 3.I have 3 jobs A B and C. I want to submit B after successful completion of A and want to submit C after successful completion of B. Without using job scheduler or job queue, how can i do that through CL program? 4.What is difference between Bind by copy and bind by reference?

4 Answers   Virtusa,


Hi, Can anybody give me real sinario for SFLRCDNBR?with example?

2 Answers  


Q1.How to read the Array? Q2.How to copy the content of one Array to another Array?

4 Answers   IBM,


Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student in rpg

0 Answers  


What is significance of a file designated as a Primary file in Rpg400 program....also what's use of secoundry file

1 Answers  


what is the use of sflnxtchg?

0 Answers   IBM,


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,


Categories