select * ,case when (select top 1 zlbm from table2 where zlbm=table1.zlbm) is not null then 't' else 'f' end as yn from table1
select table1.*, 'T' as YN from table1 where exists (select 1 from table2 where table1.zlbm=table2.zlbm) union select table1.*, 'F' as YN from table1 where not exists (select 1 from table2 where table1.zlbm=table2.zlbm)
from table1
union
select table1.*, 'F' as YN from table1 where not exists (select 1 from table2 where table1.zlbm=table2.zlbm)