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
 
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: 2032
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: 2032
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: 8356
Location: Dubuque, Iowa, USA

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: 1281
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 Utility to list Data Set Information Auryn JCL & VSAM 4 Tue Jul 17, 2018 5:03 pm
No new posts Remove duplicate record with condition rajiv rengasamy DFSORT/ICETOOL 4 Wed Jul 11, 2018 3:55 pm
No new posts LIST NODE DIRECTORY - db2 clp - tryin... elixir1986 IBM Tools 1 Sat Jul 07, 2018 6:15 pm
No new posts Varying List Select SQL Query In DB2 ... NikhilGuptaGaya DB2 5 Wed Jun 27, 2018 11:01 pm
No new posts RACF- How to find the Last access of ... rahul shanmuganatan All Other Mainframe Topics 7 Thu Jun 21, 2018 3:19 pm

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