A little example for using CASE in an MS-SQL database. From a ColdFusion page.
SELECT dbo_MerchGroup_code, dbo_MerchGroup_description, inStore_Rank,
isNew =
CASE
WHEN (new_until > GETDATE()) THEN 1
ELSE 0
END
FROM merchgroup
WHERE (inStore_Rank IS NOT NULL) AND (dbo_MerchGroup_code IN (#MerchGroupList#))
ORDER BY inStore_Rank
And... using a list...
SELECT style,
CASE WHEN [Class] IN ('32','34', '29', '28', '81', '33', '36', '31', '25', '38', '60', '67', '40', '26', '42')
THEN 'Clothes' ELSE 'Nope' END AS IsThisClothes
FROM STYLE
tags: sqlserver, case, syntax