declare @temp tabel(id int)insert @temp(id)
select parent_id from a where id=@id and parent_id<>idwhile exists(
select parent_id from a
where id in (select id from @temp)
and parent_id not in (select id from @temp)
)
insert @temp(id)
select parent_id from a
where id in (select id from @temp)
and parent_id not in (select id from @temp)select id from @id
select parent_id from a where id=@id and parent_id<>idwhile exists(
select parent_id from a
where id in (select id from @temp)
and parent_id not in (select id from @temp)
)
insert @temp(id)
select parent_id from a
where id in (select id from @temp)
and parent_id not in (select id from @temp)select id from @id
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货