"not in" doesn't work with and condition [message #371096] |
Fri, 25 August 2000 06:44 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Ankur
Messages: 22 Registered: August 2000
|
Junior Member |
|
|
The foll query works with "not in"
select productionhistory.itemno
From productionhistory, productionplan, assemblyline, Items
Where productionhistory.PID = productionplan.PID
and productionplan.lineid = assemblyline.lineid
and productionhistory.Itemid = items.itemid
and productionhistory.subassemblystatus='TESTEDOK'
and assemblyline.lineid='13'
and productionhistory.phid not in
( select qcdetails.phid from qcdetails)
order by to_number(productionhistory.itemno)
But when one more "and condition" is added it doesn't display me the correct results
select productionhistory.itemno
From productionhistory, productionplan, assemblyline, Items
Where productionhistory.PID = productionplan.PID
and productionplan.lineid = assemblyline.lineid
and productionhistory.Itemid = items.itemid
and productionhistory.subassemblystatus='TESTEDOK'
and assemblyline.lineid='13'
and items.itemcode = '1'
and productionhistory.phid not in
( select qcdetails.phid from qcdetails)
order by to_number(productionhistory.itemno)
The above query works perfectly in access & dispalys correct results
can any one help me ?
Thanks
AnkuR.
|
|
|
Re: "not in" doesn't work with and condition [message #371103 is a reply to message #371096] |
Fri, 25 August 2000 15:23 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Andrew again...
Messages: 270 Registered: July 2000
|
Senior Member |
|
|
It may be worth checking that you don't have leading or trailing spaces on your data. Has it been imported into Oracle from Access somehow?
Try something like this with your varchar2 fields:
select myfield||'<<<' from...
or
where length(myfield) != length(ltrim(rtrim(myfield)))
|
|
|
|