我有一组目前看起来像这样的数据:
出于报告目的,我必须旋转 InterviewNotes 列。据我所知,这是:
SELECT CandidateId, JobId, [1] AS Int1, [2] AS Int2, [3] AS Int3
FROM (SELECT CandidateId, JobId, InterviewNotes, InterviewNo FROM dbo.FactInterview) AS sourceTable
PIVOT (
MAX(InterviewNotes) FOR InterviewNo IN ([1],[2],[3])
) AS PivotTable
对于每一列,我想显示:InterviewName、InterviewDt、InterviewNotes 连接。如:
Int1: InterviewerName - InterviewDt - InterviewNotes
Int2: InterviewerName - InterviewDt - InterviewNotes