我正在尝试从表中取消透视多个列。到目前为止,我尝试只使用标准的 Unpivot,它在第一部分是成功的,但不是第二部分。我想要两列 Unpivote。我附上了一张我正在尝试做的事情的图片。该表与错误有关。所以E1是error1的缩写,E2是error2的缩写等等......
INSERT INTO #tempWorkflowItem
SELECT AssignmentId, Code, Response FROM #temp2
UNPIVOT(Response FOR Code in (E1, E2, E3 ))AS WorkflowItemsUnpivot
UNPIVOT(Reason FOR Code in (E1Reason, E2Reason, E3Reason )) AS WorkflowItemsUnpivot2