need some magic with generate_series()

Поиск
Список
Период
Сортировка
От Andreas
Тема need some magic with generate_series()
Дата
Msg-id 50FF0784.1070205@gmx.net
обсуждение исходный текст
Ответы Re: need some magic with generate_series()  (jan zimmek <jan.zimmek@web.de>)
Список pgsql-sql
Hi
I need a series of month numbers like  201212, 201301 YYYYMM to join 
other sources against it.

I've got a table that describes projects:
projects ( id INT, project TEXT, startdate DATE )

and some others that log events
events( project_id INT, createdate DATE, ...)

to show some statistics I have to count events and present it as a view 
with the project name and the month as YYYYMM starting with startdate of 
the projects.

My problem is that there probaply arent any events in a month but I 
still need this line in the output.
So somehow I need to have a select that generates:

project 7,201211
project 7,201212
project 7,201301

It'd be utterly cool to get this for every project in the projects table 
with one select.

Is there hope?



В списке pgsql-sql по дате отправления:

Предыдущее
От: "wln"
Дата:
Сообщение:
Следующее
От: jan zimmek
Дата:
Сообщение: Re: need some magic with generate_series()