select b.编号,b.属性1,属性2=c.属性1 from (select px=(select count(1) from @tb1 where 编号=a.编号 and 属性1<=a.属性1),* from @tb1 a) b left join (select px=(select count(1) from @tb2 where 编号=a.编号 and 属性1<=a.属性1),* from @tb2 a ) c on b.编号=c.编号 and b.px=c.px union select b.编号,c.属性1,属性2=b.属性1 from (select px=(select count(1) from @tb2 where 编号=a.编号 and 属性1<=a.属性1),* from @tb2 a) b left join (select px=(select count(1) from @tb1 where 编号=a.编号 and 属性1<=a.属性1),* from @tb1 a ) c on b.编号=c.编号 and b.px=c.px