Understanding which queries are valid and which are not can be difficult when the query involves a GROUP BY clause. This section describes a way to think about queries with GROUP BY so that you may understand the results and the validity of queries better.
How queries with GROUP BY are executed
Using GROUP BY with multiple columns
WHERE clause and GROUP BY