"Billy G. Allie" wrote:
> 
> Hannu Krosing wrote:
> > rodneyr@embratel.com.br wrote:
> >
> > > Does someone know how to get the result of the AVG function in a float type,
> > > without changing the structure of my table?
> >
> > Try this:
> >
> > hannu=> select avg(i * 1.0) from t;
> > avg
> > ---
> > 3.8
> > (1 row)
> >
> Actually, this will work without the need for a multiplication:
> 
>         bga=> select AVG(i::float) from t;
>         avg
>         ---
>         3.5
>         (1 row)
The ANSI-fied form of which is :
hannu=> select avg(cast(i as float)) from t;
avg
---
3.8
(1 row)
---------------
Hannu