On 7/21/2013 12:06 PM, Simon Slavin wrote:
One of the problems with this is that it's not standard SQL.  You're not meant 
to be able to refer to column aliases inside the SELECT that defines them.  For 
instance

SELECT yearJoined AS y, ageWhenJoined AS a, (y-a) AS yob FROM members

is not allowed in the SQL standard.  This is partly because the order of 
evaluation of terms in a SELECT is not defined: SQL permits those three values 
to be evaluated in any order.  Now taking a look at your query

select id, (subquery) as c from categories order by c

This query is in fact perfectly legal. It's OK to refer to column aliases in ORDER BY clause.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to