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

Need to select all records belonging to a client


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 1042
Location: Richmond, Virginia

PostPosted: Tue Jun 23, 2020 12:22 am
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: 3053
Location: NYC,USA

PostPosted: Tue Jun 23, 2020 7:17 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 2
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top