Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 20 Nov 2001 @ 20:50:49 GMT


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


Subj:   Re: Horizontal CASE Reporting
 
From:   Thomas F. Stanek

It looks like you are mixing the two different versions of the CASE statement. Try the following:

SUM(CASE
       WHEN timeon >=  (INTERVAL '00:00:01.00' HOUR to SECOND)
        and timeon <=   (INTERVAL '00:00:01.00' HOUR to SECOND)
            THEN  1
            ELSE NULL
     END)    AS  Secs_0_to_1

Your first version evaluates all of the WHEN conditions against the column specified immediately after the CASE clause. The version above evaluates each WHEN condition based on the criteria specified after the WHEN clause. The difference is that in the above version, your WHEN clauses are not limited to specifying one column. Basically, it's a more generic application of the CASE statement than you originally used.


Regards,

Thomas F. Stanek
TFS Consulting



     
  <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