Followup to week truncation thread - Mailing list pgsql-general

From Mike Nolan
Subject Followup to week truncation thread
Date
Msg-id 200509110555.j8B5tR4i017950@gw.tssi.com
Whole thread Raw
List pgsql-general
A few days ago there was a thread dealing with how  a 'week' breaks.

I just had a need to run a transaction total by week and I wanted
a Sunday-Saturday week, not a Monday-Sunday week which is what the
date_trunc function gives.

Here was my solution:

select (date_trunc('week',mtrantime + interval '1 day')
- interval '1 day')::date as week,
count(*) as tot from trantable group by 1 order by 1;
--
Mike Nolan

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Tricky SELECT question involving subqueries
Next
From: Matthew Peter
Date:
Subject: Re: back references using regex