Re: [SQL] Grouping by week

2004-08-06 Thread Tom Lane
Oliver Elphick <[EMAIL PROTECTED]> writes: > How about: >SELECT EXTRACT(WEEK FROM trans_date + '1 day'::INTERVAL) Note that if trans_date is actually a date, you are much better off just adding an integer to it: SELECT EXTRACT(WEEK FROM trans_date + 1) If you add an interval then the date

Re: [SQL] Grouping by week

2004-08-06 Thread Oliver Elphick
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 Mo

[SQL] Grouping by week

2004-08-06 Thread Caleb Simonyi-Gindele
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