|  |  | Archives of the TeradataForumMessage Posted: Thu, 13 Nov 2008 @ 10:29:57 GMT
 
 
  
| Subj: |  | Re: Option for getting subtotals in a data column |  |  |  | From: |  | Sapra, Kapil Dev |  
 Hi, You can use SUM window function.. But this will give calculated result in extra column. 
     Group total..
     SELECT col1
        , col2
        , Ncol3
        , SUM(Ncol3) OVER (PARTITION BY col1
        ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
     FROM tbl1
     ORDER BY 1,2;
 For Grand total you can use.. 
     :
     FROM tbl1
     WITH SUM(Ncol3)
     ORDER BY 1,2;
     WITH SUM(Ncol3)
 Best Regards, Kapil Dev Sapra 
 
 |  |