Re: Query design assistance - getting daily totals

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: "Paul Lambert" <paul(dot)lambert(at)reynolds(dot)com(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Query design assistance - getting daily totals
Date: 2007-12-12 19:53:08
Message-ID: a55915760712121153x5c9a10a1s89c737a44e4eb149@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Dec 12, 2007 1:39 AM, Paul Lambert <paul(dot)lambert(at)reynolds(dot)com(dot)au> wrote:
> It's a financial application which needs to work using a concept of
> 'financial periods' which may not necessarily correspond to calendar
> months and it's much easier to manage in this way than it is to merge it
> all together using a date field. Eg, 1st January may actually be the
> 15th 'working day' of the 9th 'financial period' - however looking at
> just a date of jan-1 there is no way of knowing this and it's the
> periods that matter more so than the actual date.

I think what you need is a Calendar Table to "map" actual dates to
"buckets" e.g. 'financial periods', etc. See:

http://codeinet.blogspot.com/2006/08/auxiliary-calendar-table-for-sql.html

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2007-12-12 20:21:21 Re: Query Assistance
Previous Message Gary Chambers 2007-12-12 18:00:50 Re: Query Assistance