You cannot vote on your own post
In t-sql 2012, the following sql works when I use a union all statement. However I would prefer not to
use a union all if at all possible. The problem is there are a few times when the join does not find anythning.
When the join occurs there are some cases where attributeID= 997 or 1452, does not have a match by personID.
The goal is is there is value <>'N' in all cases, the result attributeID value should be set to 3370.
,attributeID=case when c2.value = 'N' then 3371 else 3370 end
and c2.date = c1.date
and C2.attributeID= 997
where C1.attributeID = 1452
where C3.attributeID = 1452
and c3.personID not in
(select c4.personID from O.dbo.CustC4
where c4.attributeID= 997)
Thus can you modify the sql above to meet my requirement?