xxxxxxxxxx
Select Count(*)
From (
Select
From TempTable
Group By column_1, column_2, column_3, column_4
) As Z
xxxxxxxxxx
# To count the number of teachers in each department, including
# rows where COUNT(t.name) == 0
SELECT d.name,COUNT(t.name) FROM teacher t
RIGHT JOIN dept d ON (t.dept=d.id) GROUP BY d.name;
xxxxxxxxxx
SELECT occupation, COUNT(*) AS Total_employee
FROM employee_info
GROUP BY occupation
ORDER BY occupation;