How do I solve this efficiently? - Mailing list pgsql-general

From elwood@agouros.de (Konstantinos Agouros)
Subject How do I solve this efficiently?
Date
Msg-id elwood.980607938@news.agouros.de
Whole thread Raw
Responses Re: How do I solve this efficiently?
List pgsql-general
Hi,

I have a table like the following :
          Table "expenses"
 Attribute |    Type     | Modifier
-----------+-------------+----------
 datum     | date        |
 ware      | varchar(80) |
 price     | float4      |

To get a summary of what I spent in a month I do a:
select ware,sum(price) from ausgaben where datum >= '1-1-2000' and datum <
'2-1-2000';

Now I would like to have an overview for a year in the form:

Ware  January February March ...
Food    50.0      40.0  60.0
CDs.    20.0            40.0

.....

What's the easiest way of doing this?
I would like to avoid creating to many temporary tables if possible.

Konstantin

--
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not sustain the forming of the cosmos." B'Elana Torres

pgsql-general by date:

Previous
From: "Jeffery Jansen"
Date:
Subject: ...
Next
From: "Matt Friedman"
Date:
Subject: Re: postgres limitation -what does it mean? (8k row limit)