The following statement is equivalent to the first example of the valued form of CASE on “Example”:
SELECT SUM(CASE WHEN part='1' THEN cost ELSE 0 END ) / SUM(cost) FROM t;
The following statement is equivalent to the first example of the valued form of CASE on “Example”:
SELECT SUM(CASE WHEN part='1' THEN cost ELSE 0 END ) / SUM(cost) FROM t;