List:General Discussion« Previous MessageNext Message »
From:Shawn Green Date:August 27 2007 7:15pm
Subject:Re: where column
View as plain text  
Olav Mørkrid wrote:
> hello
>
> does anyone know what is returned when you do a where column without
> further parameters?
>
> SELECT * FROM TABLE WHERE COLUMN;
>
> for integer columns it seems to return non-zero columns, but for other
> types of columns the results seemed unpredictable.
>
>   
The value of the column will be converted to a TRUE or FALSE value (1 or 
0). If the column would evaluate in a numerical setting to a value of 0, 
the statement would read "WHERE FALSE" and not show that row. Can you 
provide an example of a resultset that does not make sense to you?

Its no different than providing an actual equation to provide the true 
or false condition

SELECT... FROM ... WHERE 0  will always return no data as the WHERE 
condition will never be true.

-- 
Shawn Green, Support Engineer
MySQL Inc., USA, www.mysql.com
Office: Blountville, TN
    __  ___     ___ ____  __
   /  |/  /_ __/ __/ __ \/ /
  / /|_/ / // /\ \/ /_/ / /__
 /_/  /_/\_, /___/\___\_\___/
        <___/
 Join the Quality Contribution Program Today!
 http://dev.mysql.com/qualitycontribution.html 

Thread
where columnOlav Mørkrid24 Aug
  • Re: where columnReinhardt Christiansen24 Aug
  • Re: where columnShawn Green27 Aug