Folding subtotals into query?

From: Jerry LeVan <jerry(dot)levan(at)eku(dot)edu>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Folding subtotals into query?
Date: 2004-04-18 18:41:26
Message-ID: FF81597A-9167-11D8-9438-000393779D9C@eku.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is is possible, via some clever sql coding ( perhaps with PL/pgsql)
to get subtotals to appear in a selection, ie

If I have a query: select * from checks order by category
I would like the have the subtotals appear (possibly in
an unused column for each "category" when the category
"breaks".

Basically I would like to meld the query:
select category, sum(amount) from checks group by category order by
category

Into the of the first select.

Thanks,

Jerry

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric Ridge 2004-04-18 19:10:54 Re: Folding subtotals into query?
Previous Message Frank Finner 2004-04-18 16:41:34 Re: Mixed UTF8 / Latin1 database