Assuming two simple tables, teachers with columns id and name, and comments with columns id, comment, and teacher ...
SELECT t.id, t.name, COUNT(comments.comment) AS commentCount
FROM teachers AS t
LEFT JOIN comments
ON t.name = comments.teacher
GROUP BY t.id
ORDER BY commentCount DESC;
This query will yield a result set with columns id, name, and commentCount. The results will be have the teachers with the most comments at the top, and those with none at the bottom.
Is this the sort of thing you were looking for?