An SQL primer
GROUP BY is used to define groups of rows to which aggregate functions can be applied.
Each item in the SELECT list must produce a single value per group (or set).
Example: How many times does each valuecount occur in the ENUMTYPES table?
- SELECT VALUECOUNT,COUNT(*) AS "#Occurrences” FROM ENUMTYPES GROUP BY VALUECOUNT