Reputation: 1
I am new to mysql. In the above table i have to SUM attendance_status(column)
depending on the date like
01/05/2013 att_stat=0
01/05/2013 att_stat=1
02/05/2013 att_stat=0
02/05/2013 att_stat=1
It's working pretty well when thr is only 3 record when I insert 4th one its not working
SELECT SUM(Attendance_Status) as total FROM student_attendance1 Where Attendance_Status='1' and Date= '"+datevalue+"'";'
Upvotes: 0
Views: 223
Reputation: 1094
Basically you are close just have to put GROUP BY
SELECT
SUM(Attendance_Status) AS total
FROM student_attendance1
WHERE Attendance_Status = '1'
AND DATE = '"+datevalue+"'"
GROUP BY DATE
Upvotes: 3