;with temp as (select a as 原始单号,a as 当前单号 from table1 where a='9051'union allselect temp.原始单号 as 原始单号,table1.b as 当前单号 from table1 inner join temp on temp.当前单号=table1.a )select * from temp