How do I solve this efficiently?

Поиск
Список
Период
Сортировка
От elwood@agouros.de (Konstantinos Agouros)
Тема How do I solve this efficiently?
Дата
Msg-id elwood.980607938@news.agouros.de
обсуждение исходный текст
Ответы Re: How do I solve this efficiently?
Список 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 по дате отправления:

Предыдущее
От: "Jeffery Jansen"
Дата:
Сообщение: ...
Следующее
От: "Matt Friedman"
Дата:
Сообщение: Re: postgres limitation -what does it mean? (8k row limit)