select 1 as DepID,N'家纺事业部' as DeptName,0 ParentDeptID
into #t
union all select 3,N'运营部',0
union all select 5,N'总经理室',0
union all select 6,N'六组',1
union all select 46,N'二组',1
union all select 90,N'国际采购部',144
union all select 9,N'一组',41
union all select 10,N'家纺QA组',101
union all select 50,N'财务部',147
union all select 13,N'人力资源&行政部',0
union all select 14,N'家纺设计组',102
union all select 54,N'总经办',147
union all select 65,N'三组',1
union all select 17,N'仓库',3
select t1.*,t2.DeptName ParentDeptName
from #t t1
left join #t t2 on t1.ParentDeptID=t2.DepID