Re: Celko: help with an experiment

From: Paulie <paul_at_not.a.chance.eircom.net>
Date: Sat, 06 Jul 2002 23:36:03 GMT
Message-ID: <3d277d11.78977703_at_news1.eircom.net>


71062.1056_at_compuserve.com (--CELKO--) wrote:

MySQL - Win2000 Pro

> 1) SELECT * FROM Foobar;
> [X ] 1

> 2) SELECT MAX(i) FROM Foobar;
> [X ] 1

> 3) SELECT * FROM Foobar WHERE 1 = 0;
> [X ] 1

> 4) SELECT MAX(i) FROM Foobar WHERE 1 = 0;
> [X ] NULL

> 5) SELECT CASE WHEN 1 = 1
> THEN 99
> ELSE COUNT(*) END AS x
> FROM Foobar
> WHERE 1 = 0;
 
> [X ] Empty set

with or without ; at the end...see below.

> 6) SELECT CASE WHEN 1 = 0
> THEN 99
> ELSE COUNT(*) END AS x
> FROM Foobar
> WHERE 1 = 0;

> [X ] Warning
> [ X] Fatal error

May be one or the other



You have an error in your SQL syntax near '; ' at line 5

I leave it to you to judge.

Strangely, though, if you have



SELECT CASE WHEN 1 = 0
                THEN 99
                ELSE COUNT(*) END AS x
      FROM Foobar
     WHERE 1 = 0
--------------------------

i.e. without the final ";" - then it's an empty set....

Rgs.

Paul...

> --CELKO--
Received on Sun Jul 07 2002 - 01:36:03 CEST

Original text of this message