<?php // How many employees are? $rowcount = Employees::count(); // How many different areas are assigned to employees? $rowcount = Employees::count(array("distinct" => "area")); // How many employees are in the Testing area? $rowcount = Employees::count("area = 'Testing'"); //Count employees grouping results by their area $group = Employees::count(array("group" => "area")); foreach ($group as $row) { echo "There are ", $row->rowcount, " in ", $row->area; } // Count employees grouping by their area and ordering the result by count $group = Employees::count(array("group" => "area", "order" => "rowcount"));