M Wilson wrote:Subquery:
(SELECT PARTY_CD
FROM TABLE01
WHERE PARTY_CD != '99')
My recommendation was that the subquery should find the IDs that you do not want. So those that do equal 99. And you want to return the ID_NUMBERS, not the PARTY_CD
M Wilson wrote:Like this:
SELECT ID_NUMBER
FROM TABLE01
WHERE PARTY_CD IN ('00', '10', '30')
AND (SELECT PARTY_CD FROM TABLE01 WHERE PARTY_CD != '99')
FETCH FIRST 1 ROWS ONLY
Which is close to what you want, assuming you change the subquery. If the subquery is returning the ID_NUMBERS you don't want, then all you need is some way of saying in your
AND statement that the found
ID_NUMBER is
NOT IN the subquery.
Does that get you closer to a solution?