select t1.UserID, t1.ManagerID, t1.SomeData,t1.SomeYear as Year1, NZ(t2.SomeYear, "-") as Year2
from MasterTable t1
left join SecondTable t2
on t2.UID = t1.userid
UNION
select st.UID, st.ManagerID, st.SomeData,"-" as Year1, st.SomeYear as Year2
from SecondTable st
left join mastertable m
on m.userid = st.uid where (m.userid is null)
|