SELECT
	entry.student_id,
	COUNT(DISTINCT(entry.student_id, entry.date)) AS entry_count,
	SUM(
		CASE WHEN ck.category = 'Classroom Readiness'
		THEN 1 ELSE 0 END
	)
		AS classroom_readiness_item_count,
	SUM(
		CASE WHEN ck.category = 'Classroom Readiness' AND ck.checked
		THEN 1 ELSE 0 END
	)
		AS classroom_readiness_item_count_checked,
	SUM(
		CASE WHEN ck.category = 'Behavior'
		THEN 1 ELSE 0 END
	) AS behavior_item_count,
	SUM(
		CASE WHEN ck.category = 'Behavior' AND ck.checked
		THEN 1 ELSE 0 END
	) AS behavior_item_count_checked
FROM classroom_compliance_entry entry
LEFT JOIN classroom_compliance_entry_checklist_item ck
	ON ck.class_id = entry.class_id AND
		ck.student_id = entry.student_id AND
		ck.date = entry.date
WHERE
	entry.date >= ?
	AND entry.date <= ?
	AND entry.class_id = ?
GROUP BY entry.student_id