I have a student attendance table in mysql 19BE1attendance. The columns are number, name, total, Week_2, Week_1
Week_X is either 1 or 0
Of course the number of weeks will increase as the term goes on.
The column total should be the sum of the Week_X values.
This does what I want, all the values are added nicely in the third column total:
SELECT Week_2, Week_1, (Week_1 + Week_2) as total FROM 19BE1attendance;
EDIT: I made php which can import a .csv into a table. That is how the attendance values will get into the attendance table.
Now I have total. Assume I have another table totals with 3 columns number name totals
How do I get total in the column totals for each student?
Or, alternatively, add the attendance values on the fly and output them in a webpage with a foreach() when a student wishes to consult his or her scores.
I can already output fictitious score values using php.
(number is the student number and is a unique identifier for each student)