How would you get a breakdown of how many employees in each city ?
Do I have to loop with a Count(*) for each CityID, or something ?
There must be a more straightforward method.Like this:
SELECT
CityID,
COUNT(*)
FROM
Employees
GROUP BY
CityID
The key part of that is the GROUP BY. That means to collapse theresults on the CityID column, and the COUNT(*) will keep track of howmany rows were collapsed.