Help in exists / not in [message #448165] |
Fri, 19 March 2010 23:24  |
kumarvk
Messages: 214 Registered: July 2004
|
Senior Member |
|
|
Dear Experts,
I have the following query.
SELECT A.chs_no, a.engine_no, a.lic_no
FROM MROH A
WHERE A.code = 'O7'
AND A.eng_no LIKE '%Z13DTJ%'
AND NOT EXISTS
(SELECT NULL
FROM mroj C
WHERE a.id = c.rohd_id
AND c.JC = 'T1179'
AND c.STS != 'X');
I want to pick from table A which don't have the code 'T1179' table B have many codes. But I am not getting the correct result. Anyone can help.
|
|
|
|
Re: Help in exists / not in [message #448177 is a reply to message #448165] |
Sat, 20 March 2010 02:11  |
 |
Michel Cadot
Messages: 68761 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
With what you posted, assuming you are able to write the correct query for the result you want, the only thing that comes in mind is "take care of null".
Quote:I want to pick from table A which don't have the code 'T1179' table B have many codes.
Explain this. Table A has no code 'T1179'? but you test the code in table B (actually C) in your query.
What does mean "table B have many codes"?
Regards
Michel
|
|
|