List:General Discussion« Previous MessageNext Message »
From:Ed Reed Date:January 4 2006 8:40pm
Subject:Re: Can someone tell me why this fails?
View as plain text  
Thanks Peter, for the quick reply.

>>> Peter Brawley <peter.brawley@stripped> 1/4/06 11:44 AM
> >>>

Ed,

>Can someone tell me why this fails? I'm using v4.1.11
>Select IF(((Select 1+1) <> Null) and ((Select 1+1) <> 0), (Select 1+1),
> 'WRONG')
>I would expect a result of 2.

NULL is neither equal nor unequal to anything including itself. 

To get the result you expect, write

Select IF(((Select 1+1) IS NOT Null) and ((Select 1+1) <> 0), (Select 1+1),
'WRONG');

PB



Thread
Can someone tell me why this fails?Ed Reed4 Jan
  • Re: Can someone tell me why this fails?Peter Brawley4 Jan
Re: Can someone tell me why this fails?Ed Reed4 Jan