0
我写了下面的查询来检查重复项。检查空列值的情况下,并忽略它们
select s.*,m.IsMember_Ind,
case when REPLACE(s.[ Owner Mobile],' ','')
in (select cd.Mobile
from Company_Detail cd
inner join MEMBERSHIP m
on cd.Company_ID = m.Company_ID
where m.IsMember_Ind = 1)
then 'Match'
else ' ' end as OwnerMobileMatch,
case when REPLACE(s.[ Contact Number],' ','')
in (select cd.Mobile
from Company_Detail cd
inner join MEMBERSHIP m
on cd.Company_ID = m.Company_ID
where m.IsMember_Ind = 1)
then 'Match' else ' ' end as ContactMobileMatch
from COMPANY c
inner join surreynonmembers s
on c.TTR_ID = s.[Company ID]
left outer join MEMBERSHIP m
on m.Company_ID = c.Company_ID
我的问题是,case语句返回匹配时发现一个空值,我不需要。如果只有一个值,我该如何修改这个查询来返回?
为什么不只是使用另一种情况,或者如果使用ISNULL()函数呢? – sdrzymala 2015-02-06 13:56:24
或者在ContactMobileMatch中包含'AND'S。[Owner Mobile] <>'''在OwnerMobileMatch和'AND s。[Contact Number] <>'''中。 – Tom 2015-02-06 21:44:40