Dennis Cote <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > > Can you please tell me what > > other databases do with this: > > > > CREATE TABLE t1(a,b,c); > > INSERT INTO t1 VALUES(1,2,4); > > SELECT a+b AS c FROM t1 WHERE c==4; > > > > 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? > > > > > > > > According to the where clause definition in the SQL:1999 standard the > "c" in the where clause should refer to the column in table "t1" which > is the result of the preceding from clause. To conform to the standard > SQLite should return 3. >
I never would have guessed things worked that way. But then again, SQL is not noted for making a whole lot of sense. So it appears that a bug in my implementation cancelled out a bug in my understanding of SQL. How often does that happen: two bugs cancelling each other out perfectly.... Dennis: In the developers chatroom, Dan Kennedy is marvelling at your ability to read and decypher standards documents.... -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------