Mike
Administrator
Hero Member
    
Posts: 571

|
 |
« Reply #1 on: April 20, 2009, 08:22:29 am » |
|
This is an example of syntax for the GROUP BY clause:
SELECT column1, column2, ... column_n, aggregate_function (expression) FROM tables WHERE predicates GROUP BY column1, column2, ... column_n;
aggregate_function can be a function such as SUM, COUNT, MIN, or MAX.
Here's an example that uses the COUNT function:
SELECT department, COUNT(*) as "Number of employees" FROM employees WHERE salary > 25000 GROUP BY department;
Here's an example that uses the MIN function:
SELECT department, MIN(salary) as "Lowest salary" FROM employees GROUP BY department;
|