3 ms·
Since SQL Server 2012, you can use the lovely IIF statement, which is translated into a CASE behind the scenes. So: CASE WHEN SUM(express_delivered) = 0 THEN
by gary__ 10y ago
Since SQL Server 2012, you can use the lovely IIF statement, which is translated into a CASE behind the scenes.
So:
CASE WHEN SUM(express_delivered) = 0 THEN 0 ELSE 1 END AS ever_been_express_delivered
becomes:
IIF(SUM(express_delivered) = 0, 0, 1) AS ever_been_express_delivered
https://msdn.microsoft.com/en-GB/library/hh213574.aspx https://msdn.microsoft.com/en-GB/library/hh213574.aspx