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 anybody tell me, does CL/400 handle LEVEL check while running the CL program....? plz share your experience...

4 Answers  


Hi, Can any body tell me ur experience on this questions? Questions: 1.what is the use of SFLRCDNBR other than subfile page display? 2.Which of the following operation cannot be used in conjuction with a file coded as device type disk?

1 Answers  


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

6 Answers  


What is the difference between iter and do?

0 Answers  


Suppose i am having 3 programs PgmA,pgmB,pgmC and using source debugger. At debugging time i found that pgmC having some code error..then in debug mode directly how can i debug pgmC

2 Answers  


Is it possible to call a subfile using CL. IF yes.. kindly help me out with explanation...?

3 Answers  


Suppose we have 10 records with same name and we are reading using READE,after 4 record i have to use CHAIN what is the output

3 Answers  


Hi, I am getting the error in RPG (All Record Formats for externally-described file ABCD ignored or dropped due to error; file ignored.) Please suggest any

2 Answers   Satyam,


How to print output from openquery in as400 ?

1 Answers   Four soft,


1) How to retrieve RRN through RPG ? 2) How to pass parameter by value ? 3) How to trap the error through the RPG/400

10 Answers   IBM, Tech Mahindra,


how to change the length of the field in a physicalfile?

12 Answers  


what are the types of identifers

2 Answers   IBM,


Categories