I think that you can put the aggregates directly into the SELECT
clause rather than referring to them by alias, i.e. 

select city, sum(Weight)/count(id) as AvgWeight

   -Tom

> -----Original Message-----
> From: de f [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, May 17, 2005 1:55 PM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Can I refer to a column alias in same SQL 
> Select statement?
> 
> Is there any way to do the following without using subqueries or
> repeating the formulas?
> 
> select city, count(id) as TotalNum, sum(Weight) as TotalWeight,
>  TotalNum/TotalWeight as AvgWeight...
> 
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 

Reply via email to