Skip to content

Latest commit

 

History

History
13 lines (12 loc) · 669 Bytes

3005.md

File metadata and controls

13 lines (12 loc) · 669 Bytes

GROUP BY Usage

Do not reference non-grouped columns:

Every column in the select-list of a query must have a single value row per row group. This is called the Single-Value Rule. Columns named in the GROUP BY clause are guaranteed to be exactly one value per group, no matter how many rows the group matches. Most DBMSs report an error if you try to run any query that tries to return a column other than those columns named in the GROUP BY clause or as arguments to aggregate functions. Every expression in the select list must be contained in either an aggregate function or the GROUP BY clause. Follow the single-value rule to avoid ambiguous query results.