I have a query that orders results by the count of another table:

"SELECT table1.*, COUNT(table2.id) AS rev_count FROM table1
LEFT JOIN table2 ON table1.name = table2.name
WHERE table1.active = 1 AND table1.city='$city'
GROUP BY table1.name
ORDER BY rev_count DESC";

How do you add a condition (ie WHERE active=1) to just the "COUNT(table2.id) AS rev_count" part of the query?