Some DDL would have been helpful. Still, here's a guess. Despite the title of the thread, you don't need a loop - you can do it with a set-based query.
SELECT School, Town, COUNT(StudentID)
FROM Students
GROUP BY School, Town
John
Viewing post 1 (of 2 total)
You must be logged in to reply to this topic. Login to reply