On 5/18/2011 6:11 PM, Petite Abeille wrote: > In other words, how come the following works in SQLite: > > select 1 as value where value> 0; > > Or even weirder: > select 1 as value where value = 0; > > There is no from clause, there is no column 'value' per se, but nonetheless > that non existing column can be referenced in the where clause. What gives?
That's SQLite extension. I don't believe it's legal standard SQL. The alias in the SELECT clause acts kind of like a macro; its use in the rest of the statement is simply replaced with the corresponding expression. The query could be written without using this feature, but it wouldn't be quite as neat and readable. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users