Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 10 Mar 2004 @ 13:57:07 GMT


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


Subj:   Re: SQL for a Weekly Summary?
 
From:   de Wet, Johannes M

Manish,

Actually, thinking about it a little more - you don't need the second join to the System Calendar at all. Try this.

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: 27 Dec 2016