pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: Caleb Simonyi-Gindele <csg@bordervet.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: Grouping by week
Date: Fri, 06 Aug 2004 23:08:31 +0100
Message-ID: <1091830111.13140.1.camel@linda> (raw)
In-Reply-To: <000001c47bfc$69d79e50$c201a8c0@borderveygqj37>
References: <000001c47bfc$69d79e50$c201a8c0@borderveygqj37>

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 




view thread (3+ messages)  latest in thread

Message-ID: <1091830111.13140.1.camel@linda>
Permalink:  ../1091830111.13140.1.camel@linda/
Also on:    postgresql.org/message-id/1091830111.13140.1.camel@linda

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: olly@lfix.co.uk, csg@bordervet.ca
  Subject: Re: Grouping by week
  In-Reply-To: <1091830111.13140.1.camel@linda>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox