我有一个连接两个表的查询。结果我需要以 为中心QuestionID
,因为现在QuestionID
是垂直而不是水平
这是我的查询
select
b.TOKEN,a.[GUBSRVY_TITLE], a.[QuestionID],b.[GURSRVQ_TEXT],(cast(isnull([GORSRVR_RESPONSE_1], 0) as int)
+ cast(isnull([GORSRVR_RESPONSE_2],0) as int) + cast(isnull([GORSRVR_RESPONSE_3],0) as int)
+ cast(isnull([GORSRVR_RESPONSE_4],0) as int) + cast(isnull([GORSRVR_RESPONSE_5],0) as int))
as RESPONSE
from [QuestionMappingNew3] a
left join [AUB_ICE_SURVEY_ANSWERS_MV] b
on a.[GUBSRVY_TITLE] = b.[GUBSRVY_TITLE]
join [AUB_ICE_SURVEY_ANSWERS_SUMMARY_MV] c
on b.[GUBSRVY_TITLE] = c.[GUBSRVY_TITLE]
where TERM = '2020'
输出是
TOKEN GUBSRVY_TITLE BlueQuestionID GURSRVQ_TEXT RESPONSE
939 201420-BUSS-350D-1-L-Bizhan Azad Q2Row1 The instructor was prepared for the class 5
939 201420-BUSS-350D-1-L-Bizhan Azad Q3Row1 The instructor was prepared for the class 5
939 201420-BUSS-350D-1-L-Bizhan Azad Q4Row1 The instructor was prepared for the class 5
我需要它来QuestionID
排成一行。我怎么能用枢轴做到这一点
提前谢谢你