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

Fetch only rows that are duplicate


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Mar 25, 2010 11:54 am
Reply with quote

Hi,

I want to run query which will fetch only rows that are duplicate?
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Thu Mar 25, 2010 12:44 pm
Reply with quote

Hello Sriram,

You need to provide the basis for duplicate rows. Is it contain same value for all the column etc. I am afraid without which suggestion would nt be of much help.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 25, 2010 12:45 pm
Reply with quote

Is this ok for you?
Code:

SELECT col1,COUNT(*) 
FROM tab1           
GROUP BY col1         
HAVING COUNT(*)  > 1;     
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Thu Mar 25, 2010 2:30 pm
Reply with quote

Thanks Sambhaji.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 25, 2010 2:36 pm
Reply with quote

I am glad, I could GUESS your requirement.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Mar 25, 2010 2:38 pm
Reply with quote

Must have been psychic day icon_lol.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 25, 2010 2:41 pm
Reply with quote

expat wrote:
Must have been psychic day icon_lol.gif

I think getting up late from bed nourishes being telepathic icon_lol.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Fetch data from programs execute (dat... DB2 3
No new posts Duplicate several members of/in one l... JCL & VSAM 7
Search our Forums:

Back to Top