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

how to find the duplicate list


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

New User


Joined: 24 Feb 2016
Posts: 3
Location: india

PostPosted: Wed Mar 30, 2016 12:11 am
Reply with quote

Hi my requirement is ,I have found out the duplicate list from the table but I need to find the list containing the names , like
Code:
MANISH
MANISH
MANISH
RAVI
RAVI


I have used the below query for my requirement

Code:
SELECT (NMFIRST||NMLAST||CHAR(DTBIRTH)||CHAR(ADEMAIL))   
  FROM TABLE                                     
GROUP BY (NMFIRST||NMLAST||CHAR(DTBIRTH)||CHAR(ADEMAIL)) 
HAVING COUNT(*)>1                                         
WITH UR;


My query is just giving me the results of the duplicate values but I need descriptive details like all the duplicates should be visible
Code:
                   MANISH
                   MANISH
                   MANISH
                   RAVI
                   RAVI


Please help.

Coded, converted to lower case and 'asap' removed
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Mar 30, 2016 1:28 pm
Reply with quote

RAVIGUPTA1990,

1 - do not SHOUT (use all upper case)
2 - use the code tags to present code, data and cut'n'paste from screen
3 - if you need ASAP hire a consultant

These have all been fixed for you - this time.


You did not show what your results were so we have no idea what you are getting at.
Back to top
View user's profile Send private message
RAVIGUPTA1990

New User


Joined: 24 Feb 2016
Posts: 3
Location: india

PostPosted: Wed Mar 30, 2016 2:53 pm
Reply with quote

I was not saying do it immediately ,i used please .My requirement is to get the list of duplicate values in a table with all occurences
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Mar 30, 2016 4:41 pm
Reply with quote

ASAP = As Soon As Possible
it does not mean 'please'. 'Please' means 'please'
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Mar 30, 2016 4:53 pm
Reply with quote

Have you thought about what a GROUP BY means in an SQL query?
Back to top
View user's profile Send private message
RAVIGUPTA1990

New User


Joined: 24 Feb 2016
Posts: 3
Location: india

PostPosted: Wed Mar 30, 2016 7:29 pm
Reply with quote

Thanks ,i have got the solution for this . icon_surprised.gif
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Tue Apr 05, 2016 6:24 pm
Reply with quote

If your table has a primary_key :
Code:
Select * from Mytable A,
where exists( select * from Mytable B where A.some_columns  = b.some_columns and a.PK not = b.PK)
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 Duplicate transid's declared using CEDA CICS 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Duplicate several members of/in one l... JCL & VSAM 7
Search our Forums:

Back to Top