Re: Aggregate Functions

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Aggregate Functions
Date: 2006-11-20 06:06:53
Message-ID: 20061120060653.GA27960@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

am Sun, dem 19.11.2006, um 21:05:24 -0800 mailte Yadnyesh Joshi folgendes:
> According to the documentation, when "avg" or "stddev" function is used with
> integer arguments, the result is an integer. How can I obtain floating point

Thats not true:

test=> create table ints (i int);
CREATE TABLE
test=*> insert into ints values (2);
INSERT 0 1
test=*> insert into ints values (3);
INSERT 0 1
test=*> select avg(i) from ints;
avg
--------------------
2.5000000000000000
(1 row)

test=*> select stddev(i) from ints;
stddev
------------------------
0.70710678118654752440
(1 row)

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Shivin M 2006-11-20 14:00:01 Using seq. objects with COPY FROM?
Previous Message Richard Broersma Jr 2006-11-20 05:43:35 Re: Aggregate Functions