X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 60A785E46C9 for ; Fri, 6 Aug 2004 19:08:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34079-02 for ; Fri, 6 Aug 2004 22:08:39 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 0AE505E46C2 for ; Fri, 6 Aug 2004 19:08:34 -0300 (ADT) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1BtCtA-00091f-0Z; Fri, 06 Aug 2004 22:08:36 +0000 Received: from linda.lfix.co.uk ([192.168.1.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.34) id 1BtCt5-0000R4-KR; Fri, 06 Aug 2004 23:08:31 +0100 Subject: Re: Grouping by week From: Oliver Elphick Reply-To: olly@lfix.co.uk To: Caleb Simonyi-Gindele Cc: pgsql-sql@postgresql.org In-Reply-To: <000001c47bfc$69d79e50$c201a8c0@borderveygqj37> References: <000001c47bfc$69d79e50$c201a8c0@borderveygqj37> Content-Type: text/plain Organization: LFIX Limited Message-Id: <1091830111.13140.1.camel@linda> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 06 Aug 2004 23:08:31 +0100 Content-Transfer-Encoding: 7bit X-LFIX-MailScanner: Found to be clean X-MailScanner-From: olly@lfix.co.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/43 X-Sequence-Number: 18540 On Fri, 2004-08-06 at 22:29, Caleb Simonyi-Gindele wrote: > I'm using > > SELECT EXTRACT(WEEK FROM trans_date), SUM(tran_amount) ... GROUP BY > trans_date > > and it is being used to group sales results by week. It works really well. > > What I'm wondering is if I can shift the week from a Mon-Sun > articulation(default with Postgre) to a Sun-Sat sequence. I need it that way > in order to comply with a legacy stats system. How about: SELECT EXTRACT(WEEK FROM trans_date + '1 day'::INTERVAL) -- Oliver Elphick olly@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA ======================================== "Be still before the LORD and wait patiently for him; do not fret when men succeed in their ways, when they carry out their wicked schemes." Psalms 37:7