Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 9B4392E395D for ; Wed, 12 Dec 2007 02:40:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 70566-01 for ; Wed, 12 Dec 2007 02:40:09 -0400 (AST) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by postgresql.org (Postfix) with ESMTP id 1F72D2E378D for ; Wed, 12 Dec 2007 02:40:09 -0400 (AST) Received: from [127.0.0.1] (online4-new.lnk.telstra.net [139.130.169.227]) (authenticated sender plengada@optusnet.com.au) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id lBC6e5Sd017385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 12 Dec 2007 17:40:08 +1100 Message-ID: <475F8234.5090907@reynolds.com.au> Date: Wed, 12 Dec 2007 15:39:48 +0900 From: Paul Lambert User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Query design assistance - getting daily totals References: <475F3AAB.2050609@reynolds.com.au> <20071212063142.GA26523@a-kretschmer.de> In-Reply-To: <20071212063142.GA26523@a-kretschmer.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/66 X-Sequence-Number: 29758 A. Kretschmer wrote: > am Wed, dem 12.12.2007, um 10:34:35 +0900 mailte Paul Lambert folgendes: >> year_id integer >> month_id integer >> working_day integer > > Why this broken data types? We have date and timestamp[tz]. > > 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've given the function method a try and it looks to work efficiently enough. P. -- Paul Lambert Database Administrator AutoLedgers - A Reynolds & Reynolds Company