Archives of the TeradataForum
Message Posted: Tue, 20 Nov 2001 @ 20:50:49 GMT
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.
Thomas F. Stanek
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|