How to find avg() of sum()?

From: semi-ambivalent <thefronny(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to find avg() of sum()?
Date: 2010-04-16 17:57:26
Message-ID: 5849452c-f9d1-4855-a99b-3060f81732a3@u21g2000yqc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have some data fields that I have summed, grouped by a date field.
The sums are different. How can I then calculate the average value for
those sums? Everything I've tried errors out with something along the
lines of using agregates where I can't, or for using multiple values
where that is not allowed. I'm sure this can be done in one query,
without temp tables, but I don't know it and haven't found it yet in
the docs.

thanks,

sa

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2010-04-16 17:57:34 Re: Specif postgres version
Previous Message John R Pierce 2010-04-16 17:26:53 Re: Int64GetDatum