I know I need to have (although I don\'t know why) a GROUP BY clause on the end of a SQL query that uses any aggregate functions like count,
GROUP BY
count
GROUP BY also helps when you want to generate a report that will average or sum a bunch of data. You can GROUP By the Department ID and the SUM all the sales revenue or AVG the count of sales for each month.