Suppose I have table as below:
Class Student Maths English
------------------------------------
1 a 50 60
1 b - 60
2 c 70 50
2 d 40 -
And I need a SQL query to produce this result set:
Score Maths English Total
--------------------------------------
1 50 120 170
2 110 50 160
Grand Total 160 170 330
Please help.
Try this:
Note that this is T-SQL syntax, it might need a little tweaking for MySql or Oracle.