Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can anyone spot an error?

Status
Not open for further replies.

memkam

Technical User
Aug 3, 2004
40
US
Trying to run the following query:

SELECT T.ID
FROM ExpressMailTransactionReport AS T
WHERE ((T.ShipmentCharge = 0) Or (T.ShipmentCharge = Null))
ORDER BY T.ID;

ShipmentCharge is a number - thanks
 
only the "= Null" to "Is Null" but i don't know if that would make a differenc.
WHERE (((T.ShipmentCharge)=0 Or (T.ShipmentCharge) Is Null))

are you getting an error?
 
Replace this:
WHERE ((T.ShipmentCharge = 0) Or (T.ShipmentCharge = Null))
By this:
WHERE Nz(T.ShipmentCharge, 0) = 0

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks drctx and PHV.

The error I was getting was that it would not print any output. But PHV's code worked.

PHV why do I need to use the NZ function. I am generating other records where the conndition is T.ShipmentCharge = 0 and it works fine. Is there a logical reason behind why it would work when I set the condition T.ShipmentCharge = 0 and not when I set the conditions as T.ShipmentCharge <> 0

Thanks again
 
The T.ShipmentCharge <> 0 logical expression evaluate to false when T.ShipmentCharge is null as a null value is an unknown value so never equal nor different than any other value.
Either a simple WHERE Null = Null clause is always false.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top