SQL 查询 如何查询最初单据编号

2025年03月23日 04:52
有1个网友回答
网友(1):

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

select * from temp