>    CREATE TABLE t1(a,b,c);
>    INSERT INTO t1 VALUES(1,2,4);
>    SELECT a+b AS c FROM t1 WHERE c==4;

MySQL 5.0.45:

create table t1(a INT, b INT, c INT);
INSERT INTO t1 VALUES(1,2,4);
SELECT a+b AS c FROM t1 WHERE c=4;
+------+
| c    |
+------+
|    3 |
+------+

> In the WHERE clause, should the "c" resolve to
> the column "c" or to the "a+b" expression?  I'm
> guessing the "a+b" expression.  But SQLite is
> currently resolving the name to the column "c"
> in table t1.  Thus SQLite currently answers
> "3" to the SELECT statement, when I think it
> should give an empty set.  Or maybe it should give
> an error?
> 
> Opinions, anyone?

That's a good puzzle.

One might argue that the explicit alias has priority over the 
column that was not mentioned in the SELECT expression list.
But who knows.



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to