我想在其名称字段上旋转临时表数据,并对各个候选对象的各个主题标记进行适当的求和。
Temp Table
Code Name Subject Marks
Total 360
A01 ABC Subject1 10
B01 XYZ Subject1 20
C01 MNO Subject1 30
A01 XYZ Subject1 20
B01 MNO Subject1 30
C01 ABC Subject1 10
A01 MNO Subject1 30
B01 ABC Subject1 10
C01 XYZ Subject1 20
A01 ABC Subject2 10
B01 XYZ Subject2 20
C01 MNO Subject2 30
A01 XYZ Subject2 20
B01 MNO Subject2 30
C01 ABC Subject2 10
A01 MNO Subject2 30
B01 ABC Subject2 10
C01 XYZ Subject2 20
this is my temptable data with proper summing but not pivoted.
I need output for display from pivoting on temp table as follow result:
Total ABC XYZ MNO
Code Subject Marks Marks Marks Marks
Total 360 60 120 180
A01 Subject1 60 10 20 30
B01 Subject1 60 10 20 30
C01 Subject1 60 10 20 30
A01 Subject2 60 10 20 30
B01 Subject2 60 10 20 30
C01 Subject2 60 10 20 30
Required Output from Sql query
我想获取数据并按照上述要求的输出进行正确的设计。如何使用sql查询及其html显示?