Dear all,

may I ask whether there is a deeper reason why using a column alias in the same 
SELECT query doesn't work, e.g.

SELECT column1 AS a, 5*column2 AS b, a+b FROM.......

This is not an SQlite issue, it doesn't work in MariaDB either. It would, 
however, be very handy if it worked. Sometimes I have complicated 
sub-expressions (calculations or sub-queries) which I need to re-use. 
Currently, as a workaround, I do something like this:

SELECT a, b, a+b FROM (SELECT column1 AS a, 5*column2 AS b FROM .....)

But nested SELECTs don't make things clearer.

Thanks,
Thomas

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

Reply via email to