Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

how to find the duplicate list

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: how to find the duplicate list
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: 1712
Location: UK

PostPosted: Wed Mar 30, 2016 1:28 pm    Post subject:
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    Post subject:
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: 1712
Location: UK

PostPosted: Wed Mar 30, 2016 4:41 pm    Post subject:
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: 7904
Location: Bellevue, IA

PostPosted: Wed Mar 30, 2016 4:53 pm    Post subject:
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    Post subject: Reply to: how to find the duplicate list
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: 1278
Location: Belgium

PostPosted: Tue Apr 05, 2016 6:24 pm    Post subject:
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    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 How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us