--获取父类型with c as (select * from testtype where T_ID = 4union allselect a.* from testtype ajoin c on a.T_ID = c.ParentID)select top 1 * from c order by T_ID asc
--获取子类型with c as (select * from testtype where T_ID = 1union allselect a.* from testtype ajoin c on a.ParentID = c.T_ID)select * from c order by T_ID asc