您的位置:首页 > 博客中心 > 数据库 >

sqlserver 递归查询的一种写法

时间:2022-03-14 00:40

  with tmp as
 (
 select a.id,a.name,a.pid from tb a where id=‘003‘
 union all 
 select k.id,k.name,k.pid  from tb k inner join tmp c on c.id = k.pid

 )select * from tmp

热门排行

今日推荐

热门手游