View previous topic :: View next topic
|
Author |
Message |
Q5P418
New User
Joined: 10 May 2020 Posts: 7 Location: USA
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
|
|
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 |
|
|
|