I have a table of student scorecard. here is the table,
subject | mark1 | mark2 | mark3 |......|markn stud1 | 99 | 87 | 92 | | 46 stud2
//Mysql sum of multiple rows Hi Here is the simple way to do sum of columns
SELECT sum(IF(day_1 = 1,1,0)+IF(day_3 = 1,1,0)++IF(day_4 = 1,1,0)) from attendence WHERE class_period_id='1' and student_id='1'