From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: list of all months |
Date: | 2010-03-16 09:02:52 |
Message-ID: | hnnhfs$u3c$2@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 2010-03-08, query <search2006(at)rediffmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2010-03-16 09:20:44 | Re: installing uuid generators |
Previous Message | Marcin Krawczyk | 2010-03-16 07:40:02 | pgAgent stats |