请教高手 树状查询
--查询语句
select
F.FLevel as Level2,F.FChinaName as Level2Name,E.FLevel as Level3,E.FChinaName as Level3Name,D.FLevel as Level4,D.FChinaName as Level4Name,
C.FLevel as Level5,C.FChinaName as Level5Name,B.FLevel as Level6,B.FChinaName as Level6Name,A.FLevel as Level7,A.FChinaName as Level7Name
from vw_UUM_GetUserAllInfo Y
left outer join Department A on Y.FDepartmentID=A.FDepartmentID
left outer join Department B on A.FParentID=B.FDepartmentID
left outer join Department C on B.FParentID=C.FDepartmentID
left outer join Department D on C.FParentID=D.FDepartmentID
left outer join Department E on D.FParentID=E.FDepartmentID
left outer join Department F on E.FParentID=F.FDepartmentID
left outer join Department G on F.FParentID=G.FDepartmentID
--执行上面的语句出现的结果
图一:
2 2 3 3 4 4 5 5 6 6 7 7 (列)
2 2 3 3 4 4 5 5 6 6 7 7 (值)
图二:
2 2 3 3 4 4 5 5 6 6 7 7 (列)
nullnullnullnull2 2 3 3 4 4 5 5 (值)
图二数据出现错位
因为最低值为5
------解决方案--------------------
问题没有问清楚