From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | Caleb Simonyi-Gindele <csg(at)bordervet(dot)ca> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Grouping by week |
Date: | 2004-08-06 22:08:31 |
Message-ID: | 1091830111.13140.1.camel@linda |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)lfix(dot)co(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2004-08-06 22:42:04 | Re: surrogate key or not? |
Previous Message | Caleb Simonyi-Gindele | 2004-08-06 21:29:10 | Grouping by week |