mysql> select x.a from test x where 1;

1 evaluates to be true, so this should select all rows.  And it does.

5 rows in set (0.00 sec)

mysql> select * from test where 0;

This evaluates to false, so this should not select any rows.  And it does.

Empty set (0.00 sec)

mysql> select x.a from test x where x.a;

This should select all rows where the a column's value evaluates to true.  
And it does.

3 rows in set (0.00 sec)

mysql> select x.a from test x where 'a';
Empty set (0.00 sec)

I'm not quite sure why this doesn't return anything, to tell the truth.  That 
said, I cannot understand why you'd ever set up a query like these.


On Tuesday 16 April 2002 11:21 am, Svensson, B.A.T. (HKG) wrote:
> Basically I am just curious, and I did perform some few small test.
> But, I was suspecting to get all rows when I did something like
> "WHERE <valid string>", but had to write something like "WHERE NOT
> <valid string>" which feels a little bit upside down for me considering
> that integers apart from zero evaluates to true.
>
> Also it seams like this is not ISO SQL, so it could be a bit tricky
> to predict the outcome without actually having some specification of
> the behavior.
>
>       //Anders
>
> > -----Original Message-----
> > From: Christopher Thompson
> > Sent: Tuesday, April 16, 2002 6:24 PM
> > To: Svensson, B.A.T. (HKG); Mysql List
> > Subject: Re: WHERE codition test
> >
> >
> > I'm not sure what you are asking.  Everything is working correctly as far
> > as I can see.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to