coba kurangi 1 dari mingguNo:
SELECT studentID,
DATE_FORMAT(`date`, '%U') `WeekNo`,
COUNT(studentID) totalMissed
FROM hw_homework he
WHERE DATE_FORMAT(`date`, '%U') =
(SELECT MAX(DATE_FORMAT(NOW(), '%U')-1)
FROM hw_homework hi
WHERE hi.studentID = he.studentID)
GROUP BY studentID, DATE_FORMAT(`date`, '%U')