given the following table definition
I have a query written as so:
select id,
(
case
when partial >= 2 and full >=2
then sum(partial+full)
when partial >=2
then partial
when full >= 2
then full
else 0
end
) counts
from Foo
What is the minimum number of checks that I have to do to ensure that the inner when clauses:
partial>=2 and full >=2 are not invoked twice. That is does the case when/then syntax treat everything as else ifs and not just straight ifs?
You can do
Sample SQL FIDDLE