Re: [INTERFACES] AVG function

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: [INTERFACES] AVG function
Дата
Msg-id 37C804D3.BB1B63AA@trust.ee
обсуждение исходный текст
Ответ на AVG function  (rodneyr@embratel.com.br)
Ответы Re: [INTERFACES] AVG function
Список pgsql-interfaces
rodneyr@embratel.com.br wrote:
> 
> I'm using the AVG function to get the average of some integer values of my
> database,
> but the result is comming in the integer format too, and I'm loosing some
> precision.
> 
> 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 * from t;
i
-
4
4
4
4
3
(5 rows)
hannu=> select avg(i * 1.0) from t;
avg
---
3.8
(1 row)


-------------
Hannu


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: rodneyr@embratel.com.br
Дата:
Сообщение: AVG function
Следующее
От: Spirou
Дата:
Сообщение: [Fwd: bug ? get_groname: group 0 not found]