SQL Server CASE .. WHEN .. IN statement September 8, 2023 by Tarik CASE AlarmEventTransactions.DeviceID should just be CASE. You are mixing the 2 forms of the CASE expression.