sql_树形查询

with Subqry(FID,A_TypeName,A_ParentID) as
(select FID,A_TypeName,A_ParentID from tb_Appliances where FID='20160802120302537AF2B014DC67AA43D1AD0923EB2BF0A64E'
union all select b.Fid,b.A_TypeName,b.A_ParentID from tb_Appliances b,Subqry
where Subqry.FID=b.A_ParentID
)
select * from Subqry

  

posted @ 2016-08-02 14:37  zmztyas  阅读(228)  评论(0编辑  收藏  举报