Daniel Ruehle (12/30/2010)
... case
when Age > 90 then 1
when Age < 5 then 0
when Gender = 'Male' then 1
when LastName like 'SAM%' then 1
else 0
end = 1
This gets records for all people over the age of 90, males of age 5 or more and anyone with a last name that starts with the letters SAM.
Not quite. This gets records for all people over the age of 90, males of age 5 or more, and anyone age 5 or more with a last name that starts with the letters SAM. This will not retrieve a record for someone under age 5 with a last name starting with SAM.
Your point about using CASE for explicit short-circuiting is good, but your explanation is a perfect example of how careful you have to be when using CASE, for the same reason.