2015-09-20 56 views

回答

1

我不認爲Exists會滿足你的需求。嘗試使用Left Outer Join

select Coalesce(A.somecol,B.somecol) 
from tableB B 
left outer join tableA A 
on B.TID = A.TID 
Where B.TID = X --Make sure you add the filter to TableB 
1
select isnull(A.val, B.val) 
    from B 
    left join A 
    on B.TID = A.TID 
+0

我會加在哪裏B.TID = X和嘗試。 –

相關問題