Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 06 Apr 2004 @ 12:12:37 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


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



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023