SELECT Sno,TopEmpName,TopEmpID,HighLevel,CH,ED,DIR,GM,AGM,BDM,SMM,LowEmpID,Projectid
from
(
SELECT projectAllocation.proAllocationID AS Sno, temp.Intro_Name AS TopEmpName,
projectAllocation. IntrotopLevelEmpID AS TopEmpID, temper.CSShortName AS HighLevel,
companyStructure.CSShortName AS LowLevel, IntroducerMaster.Intro_Name AS LowEmpName,
projectAllocation.introLevelEmpID AS LowEmpID, projectAllocation.ProjectID as Projectid
FROM projectAllocation
INNER JOIN IntroducerMaster ON IntroducerMaster.Empid = projectAllocation.introLevelEmpID
INNER JOIN IntroducerMaster temp ON temp.Empid = projectAllocation.IntrotopLevelEmpID
INNER JOIN companyStructure ON projectAllocation.IntroLeveID = companyStructure.HLevel
INNER JOIN companyStructure temper ON projectAllocation.introtopLevelID = temper.HLevel
WHERE (projectAllocation.ProjectID != 3)
)a
PIVOT
(
max(LowEmpName) for LowLevel in(CH,ED,DIR,GM,AGM,BDM,SMM)
)pvt
ORDER BY SMM,BDM,AGM,GM,DIR,ED,CH
我在表适配器配置向导上遇到问题: “不支持PIVOT SQL构造或语句。”