Problems with "IN" clause
Posted on 2003-12-11
I wrote an sql sentence while working on a problem that doesn't work the way I expect it to. I was wondering if anyone can explain to me why this doesn't work.
select jobno from OEORD_T1 where jobno in (select jobno from UPSHH_T1 where OEUPDT_S="Y")
does not return jobno=414335
select jobno from OEORD_T1 where jobno in (123456,456789,414335)
returns 414335 and
select jobno from UPSHH_T1 where OEUPDT_S="Y"
select oeord_t1.jobno from OEORD_T1 inner join UPSHH_t1
on oeord_t1.jobno=upshh_t1.jobno where OEUPDT_S='Y'
returns 414335. I used this last statement instead of the first one to get the data that I needed. I don't understand why the original one didn't return the data I expected it to. I'm wondering if I don't understand how to use the IN clause correctly. Can anyone see what I'm doing wrong? Thanks in advance.