Is there a way to use one CASE
statement and return 2 different values?
Following query has 2 CASE
statements with same conditions.
select case when DA.value = 1
then da.Good else da.Bad end as Foo,
case when DA.value = 1
then ot.Good else ot.Bad end as Bar,
from someTable DA (nolock)
join otherTable OT (nolock) on OT...
where ...
Is there anyway, to specify that CASE
statement once?
so that there is no need to keep both CASE
statements in sync whenever the condition changes?