Re: show all record between two date after group by and aggrigation...

From: "Chad Wagner" <chad(dot)wagner(at)gmail(dot)com>
To: "Jorge Godoy" <jgodoy(at)gmail(dot)com>
Cc: "deepak pal" <deepak(dot)05pal(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: show all record between two date after group by and aggrigation...
Date: 2007-01-23 13:27:26
Message-ID: 81961ff50701230527v76016e67mce54bee992324c60@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/23/07, Jorge Godoy <jgodoy(at)gmail(dot)com> wrote:
>
> > select cal.date, coalesce(foo.x, 0) AS x
> > from (select (date_trunc('day', current_timestamp) + (s.s * interval '1
> > day'))::date AS date
> > from generate_series(1,365) AS s) AS cal
> > left join foo ON cal.date = foo.create_date;
>
> Why not, for the date part, the simpler alternative:
>
> SELECT CURRENT_DATE + s.s AS DATE FROM generate_series(1, 365) AS s;
>

That's one of the problems with having a couple dozen date/time functions
;).

--
Chad
http://www.postgresqlforums.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Aiken 2007-01-23 13:49:40 Re: too many trigger records found for relation "item" -
Previous Message George Weaver 2007-01-23 13:12:45 Re: Problems compiling from source