select case when t1.pid is null then t2.pid else t1.pid end
from t1 full join t2 on t1.pid = t2.pid
http://www.builder.com.cn/2007/1008/540581.shtml
select case when t1.pid is null then t2.pid else t1.pid end
from t1 full join t2 on t1.pid = t2.pid