Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 05 Jan 2007 @ 16:43:56 GMT


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


Subj:   Re: Counting a column multiple times based on CASE
 
From:   Srikant Adem

     select id
          ,count(Case When  frst_prch_days  between 0 and  90
                               Then trxn_id
                               Else    0
                       end )As txns_1
          ,count(case when frst_prch_days  between 91 and 365
                             then trxn_id
                             else 0
             end) as txns_2
          ,count(case when frst_prch_days  between 366 and 548
                             then trxn_id
                             else 0
            end) as txns_3
           ,count(case when frst_prch_days  ge 549
                    then trxn_id
                              else 0
            end) as txns_4
     from temp3
     group by 1


     Instead of 0 try NULL
     Else    0  replace with  Else NULL


     
  <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