Home > Archive > MySQL ODBC Connector > January 2006 > Can someone tell me why this fails?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can someone tell me why this fails?
Ed Reed

2006-01-04, 1:23 pm

--=__Part88AA7A3F.0__=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

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


--=__Part88AA7A3F.0__=--
Peter Brawley

2006-01-04, 8:24 pm

--=======AVGMAIL-43BC259F67FF=======
Content-Type: multipart/alternative; boundary=------------ 00030104070608040507
0704

-------------- 00030104070608040507
0704
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

-------------- 00030104070608040507
0704
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ed,<br>
<br>
<i>&gt;Can someone tell me why this fails? I'm using v4.1.11<br>
&gt;Select IF(((Select 1+1) &lt;&gt; Null) and ((Select 1+1) &lt;&gt;
0), (Select 1+1), 'WRONG')<br>
&gt;I would expect a result of 2.<br>
</i> <br>
NULL is neither equal nor unequal to anything including itself. <br>
<br>
To get the result you expect, write<br>
<br>
Select IF(((Select 1+1) IS NOT Null) and ((Select 1+1) &lt;&gt; 0),
(Select 1+1), 'WRONG');<br>
<br>
PB<br>
</body>
</html>

-------------- 00030104070608040507
0704--
--=======AVGMAIL-43BC259F67FF=======
Content-Type: text/plain; x-avg=cert; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Content-Description: "AVG certification"

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.12/220 - Release Date: 1/3/2006


--=======AVGMAIL-43BC259F67FF=======
Content-Type: text/plain; charset=us-ascii


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
--=======AVGMAIL-43BC259F67FF=======--
Ed Reed

2006-01-04, 8:24 pm

--=__Part1F3DEDBA.0__=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Thanks Peter, for the quick reply.


Ed,
[color=darkred]
>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.=20

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



--=__Part1F3DEDBA.0__=--
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com