count rows in each group

37 Views Asked by At

How would one implement count with a group by operation using the PHP activerecord ORM? I know that I can do this directly via custom_sql, but I am looking for a way to do this more directly through the ORM.

A sample SQL statement of the equivalent operation:

SELECT grade_level, COUNT(*) FROM SCHOOL
GROUP BY grade_level
0

There are 0 best solutions below