Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need to select all records belonging to a client

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Q5P418

New User


Joined: 10 May 2020
Posts: 7
Location: USA

PostPosted: Mon Jun 22, 2020 11:34 pm    Post subject: Need to select all records belonging to a client
Reply with quote

Need to select all records belonging to a client having a unique value in Status column (value = P)

Code:
Name      Status

David         P
David         P
Stacy         A
Stacy         A
Curry         A
Curry         P
Curry         P
Kevin         P
Kevin         P


Result expected:

Code:
Name         Status
David         P
David         P
Kevin         P
Kevin         P
Back to top
View user's profile Send private message

Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1010
Location: Richmond, Virginia

PostPosted: Tue Jun 23, 2020 12:22 am    Post subject:
Reply with quote

My turn to ask: What have you tried and what were the results?

Also, what do you mean by "unique value", and why do your expected results not include all "P" records?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2467
Location: NY,USA

PostPosted: Tue Jun 23, 2020 7:17 pm    Post subject:
Reply with quote

This is one way to get what you wanted.
Code:
SELECT A.Name, A.Status
   FROM TABLE A ,
   (SELECT Name FROM TABLE
     WHERE Status <> 'P') as B
WHERE A.Name <> B.NAME
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 ZOS Connect EE Vs z/OS client web ena... srikant314 All Other Mainframe Topics 0 Thu Sep 17, 2020 11:20 pm
No new posts Group selective VB records - Trailer ... Premnath_TJ DFSORT/ICETOOL 12 Sun Sep 13, 2020 3:38 am
This topic is locked: you cannot edit posts or make replies. SORT the records based on the second ... Ramsee SYNCSORT 1 Wed Aug 19, 2020 3:01 pm
No new posts to Insert Rows from File1 to File 2 ... Arun_Tupili DFSORT/ICETOOL 1 Thu Aug 13, 2020 6:22 pm
No new posts Retrieve multiple records with metaco... Jose Juan J CA Products 0 Sat Jul 25, 2020 1:36 am

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