Re: list of all months
От | Jasen Betts |
---|---|
Тема | Re: list of all months |
Дата | |
Msg-id | hnnhfs$u3c$2@reversiblemaps.ath.cx обсуждение исходный текст |
Ответ на | list of all months ("query" <search2006@rediffmail.com>) |
Список | pgsql-sql |
On 2010-03-08, query <search2006@rediffmail.com> wrote: > --=_484d28810a276e7b5e461f0328ee205f > Content-Transfer-Encoding: 7bit > Content-Type: text/plain; charset="UTF-8" > > Hi, > > I want to display data for all days in a month even if no data > exists for that month. Some of the days in a month might not have any > data at all. With normal query, we can display days only if data > exists.But I want to display rows for all days in a month with blank > data for non-existing day in database. > > How can this be achieved ? > an outer join to (select FIRST_DAY_OF_MONTH + generate_series(1,DAYS_IN_MONTH) -1 ) where the date columns match FIRST_DAY_OF_MONTH and DAYS_IN_MONTH are to be replaced (by you) with the apropriate expressions by some means, possibly date arithmetic.
В списке pgsql-sql по дате отправления: