News for hackers. Stuff that matters.
Re:Seldomly Used SQL: The Bool Aggregate Functions by gary__ on Thursday May 05, 2016 @04:11PM (#11639316)
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

There are no comments on this comment yet.