Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extract only duplicate rows

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ssowmya

New User


Joined: 10 Oct 2006
Posts: 40

PostPosted: Wed Dec 06, 2006 4:14 pm    Post subject: Extract only duplicate rows
Reply with quote

Hi

Could any of u pls tell me how to extract only duplicate rows from table?
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1191
Location: Bangalore,India

PostPosted: Wed Dec 06, 2006 5:09 pm    Post subject:
Reply with quote

HI There,

Code:
SELECT C1, COUNT(*)
GROUP BY C1
HAVING COUNT(*)>1
WITH UR;


Here C1 is the coloum which u r taking to identify duplicate.

Correction r welcome
Back to top
View user's profile Send private message
MFRASHEED

Active User


Joined: 14 Jun 2005
Posts: 186
Location: USA

PostPosted: Wed Dec 06, 2006 5:09 pm    Post subject: Re: Extract only duplicate rows
Reply with quote

If you want get result using SQL, then try using GROUP BY and HAVING clause:

Example:


Code:


SELECT <COLUMN_NAME> , COUNT(*) FROM TABLE.NAME 
GROUP BY <COLUMN_NAME>                             
HAVING COUNT(*) > 1                               



Result will give how count of how many duplicates also.

One more way is to download table and use SORT to get duplicate rows.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Duplicate PARM on OUTFIL sancraig16 SYNCSORT 11 Thu Apr 05, 2018 10:25 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts help to replace columns by rows Vikas Maharnawar DFSORT/ICETOOL 8 Tue Mar 06, 2018 3:27 pm
No new posts WRITE to VSAM giving duplicate RC picus_mf CICS 1 Fri Feb 23, 2018 2:52 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us