sql 递归,父子类查询
with
temp
as
(
select *
from tablea
where ID =666
union all
select b.*
from temp
inner join tablea b on b.ID=temp.ID
)
select *
from temp
with
temp
as
(
select *
from tablea
where ID =666
union all
select b.*
from temp
inner join tablea b on b.ID=temp.ID
)
select *
from temp
发表评论