sum an alias

From: Wes James <comptekki(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: sum an alias
Date: 2010-06-04 02:16:46
Message-ID: AANLkTil0i1cg1DulN4sIEIa08qM5VU5VuLoKB7u8g1-D@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

In the statement:

select
MAX(page_count_count) - MIN(page_count_count) as day_tot,
MAX(page_count_count) as day_max, sum(MAX(page_count_count) -
MIN(page_count_count)) as tot,
page_count_pdate
from page_count
group by page_count_pdate order by page_count_pdate

Is there a way to do sum(day_tot) also in the same statement?

thx,

-wes

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2010-06-04 05:54:34 Re: sum an alias
Previous Message Harald Fuchs 2010-06-03 16:08:45 Re: inner join and limit