0

I want to Pivot temp table data on its name fields with proper summing of individual subject marks of individual candidates ..

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

I Want to get data and display it with Proper design exact as above required output .how can be possible with sql query and its html display?

PHPDEVLOPER
  • 161
  • 1
  • 10
  • And what have you tried so far? There are plenty of exaples on how to create a pivot on Stack Overflow. Why didn't those answers help you? – Thom A Apr 23 '19 at 10:42
  • yes you are right but in those example i didnt find summing and how to add total fields and one column eg. marks repeadely work for individual pivot column, and individually do calculation .hope you understand me – PHPDEVLOPER Apr 23 '19 at 11:00
  • If you show you attempts, and explain why they didn't work, then we can help you debug that (and I will be happy to reopen). Otherwise the question I have marked this as a duplicate of will offer you the answer you need. – Thom A Apr 23 '19 at 11:07

0 Answers0