It regarding cakephp, my database structure are as follows :
1.) Class
- id
- name
- student_count
2.) Student
- id
- name
- class_id
- grade_id
3.) Grade
- id
- name
My question : I want my statistic page with the layout similar to -
1.) Class 1 (Total student = XX)
- Grade A student = XX
- Grade B student = XX
- Grade C student = XX
2.) Class 2 (total student = XX)
- Grade A student = XX
- Grade B student = XX
- Grade C student = XX
I am applying counterCache => true in my Student's Model with ,so that I can get the total number of student on each Classroom using a single find('all') function, but how about the number of Student in each Grade ? and how to combine 2 query into a single display ?