 |
 |
Archives of the TeradataForum
Message Posted: Tue, 06 Apr 2004 @ 12:12:37 GMT
Subj: | | Re: How to aggregate Weekly |
|
From: | | de Wet, Johannes M |
Manish,
Using the System Calendar may be your best option for summarizing by week.
Here's an example.
SELECT
sc.week_of_calendar
,MIN(sc.calendar_date) AS Week_Begin_Date
,MAX(sc.calendar_date) AS Week_End_Date
,SUM(a.check_gross_amt)
FROM
clmdb.claim_payment a
JOIN
sys_calendar.calendar sc
ON
a.payment_date = sc.calendar_date
GROUP BY 1
ORDER BY 2 DESC;
Johannes de Wet
UnumProvident
| |