Thanks for the information and the VIEW suggestion. Since SQLite already provides an extension to reference column aliases in WHERE and JOIN clauses, is there any likelihood that it might be further extended to allow them in the SELECT statement itself?
Thanks, Pete > Message: 14 > Date: Tue, 1 Nov 2011 08:26:17 -0400 > From: "Igor Tandetnik" <[email protected]> > To: [email protected] > Subject: Re: [sqlite] sqlite-users Digest, Vol 46, Issue 29 > Message-ID: <[email protected]> > Content-Type: text/plain; charset="iso-8859-1" > > Pete <[email protected]> wrote: > > Thanks. I guess I'd like to confirm just where column aliases can > > be referenced. I think they cannot be referenced within the list of > column > > names in which they are defined, and they can be referenced in any other > > clauses of the SELECT statement, eg WHERE, ORDER BY, GROUP BY, HAVING. Is > > that correct? > > Per SQL standard, column aliases can be referenced in ORDER BY, GROUP BY > and HAVING clauses. As an extension, SQLite also allows them in WHERE and > JOIN ON clauses, but again, such usage is non-standard (though very > convenient at times). Neither the standard nor SQLite implementation allow > referencing aliases in the SELECT clause. > -- > Igor Tandetnik > > > > ------------------------------ > > Message: 15 > Date: Tue, 1 Nov 2011 12:36:27 +0000 > From: Simon Slavin <[email protected]> > To: General Discussion of SQLite Database <[email protected]> > Subject: Re: [sqlite] sqlite-users Digest, Vol 46, Issue 29 > Message-ID: <[email protected]> > Content-Type: text/plain; charset=us-ascii > > > On 1 Nov 2011, at 12:26pm, Igor Tandetnik wrote: > > > Per SQL standard, column aliases can be referenced in ORDER BY, GROUP BY > and HAVING clauses. As an extension, SQLite also allows them in WHERE and > JOIN ON clauses, but again, such usage is non-standard (though very > convenient at times). Neither the standard nor SQLite implementation allow > referencing aliases in the SELECT clause. > > Am I right that the most convenient way to do this might be by using a > VIEW ? One could define a VIEW which had a number of columns like > > totalPrice = numItems * itemPrice > > then use this totalPrice column for things like sorting, right ? > > Simon. > > ******************************************* > > _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

