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