IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract only duplicate rows


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 1209
Location: Bangalore,India

PostPosted: Wed Dec 06, 2006 5:09 pm
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
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To Discard record with 0 entry if Dup... SYNCSORT 7
No new posts Extract records for a specific condit... DFSORT/ICETOOL 25
No new posts Extract ISPF table column headings CLIST & REXX 2
No new posts Reflection 3270 screen shows only 23 ... Compuware & Other Tools 6
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:


Back to Top