Thread: Followup to week truncation thread

Followup to week truncation thread

From
Mike Nolan
Date:
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