select a.sno,a.sqty,isnull(b.qty,0)
from t1 a left join t2 b on a.sno=b.sno
union all
select b.sno,0,b.qty from t2 b where b.sno not in(select sno from t1)
from t1 a left join t2 b on a.sno=b.sno
union all
select b.sno,0,b.qty from t2 b where b.sno not in(select sno from t1)
on a.sno= b.sno
order by sno
a2 20 200
a3 30 0
a4 40 400
a5 0 500
select sno=isnull(a.sno,b.sno)
,sqty=isnull(a.sqty,0)
,qty=isnull(b.qty,0)
from t1 a full join t2 b on a.sno=b.sno