Another, perhaps better way, perhaps not, assuming that the order status is available in a list table would be:
SELECT OrdNumber, OrderStatus FROM UPSOrders + WHERE OrderStatus NOT IN (SELECT OrderStatus FROM LstOrderStatus) --- [EMAIL PROTECTED] wrote: > This is not a major issue, just wanting to understand code better. > Why do I get a different result on the below select commands? > > R>sel ordnumber orderstatus from upsorders where orderstatus not exists > ordnumber ordersta > ---------------------- -------- > OR333910 -0- > OR333911 -0- > R>sel ordnumber orderstatus from upsorders where orderstatus is null > ordnumber ordersta > ---------------------- -------- > OR333911 -0- > > Also note that the "not exists" statement takes much longer to > return the selection than the "is null" statement which is almost instant. > > I had a snippet of code that was not finding all the records. Simply changing > it to not exists > fixed the problem, but I was wondering what the difference is. > > Thanks, > -Bob Albert Berry Management Consultant RR2 - 1252 Ponderosa Drive Sparwood BC, V0B 2G2 Canada (250) 425-5806 (250) 425-7259 (708) 575-3952 (fax) [EMAIL PROTECTED]
