GROUP BY with WHERE clause exampleThis example uses the GROUP BY clause with a WHERE clause to return the number of shipped orders for every customer:
| SELECT name, COUNT ( order_id ) FROM orders INNER JOIN customers USING (customer_id) WHERE status = 'Shipped' GROUP BY name ORDER BY name; |
Here is the output:

GROUP BY with WHERE clause exampleThis example uses the GROUP BY clause with a WHERE clause to return the number of shipped orders for every customer:
GROUP BY with WHERE clause exampleThis example uses the GROUP BY clause with a WHERE clause to return the number of shipped orders for every customer:
| SELECT name, COUNT ( order_id ) FROM orders INNER JOIN customers USING (customer_id) WHERE status = 'Shipped' GROUP BY name ORDER BY name; |
Here is the output:

| status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
|---|---|---|---|---|---|---|---|
| repetition number in this series | 0 | memorised on | scheduled repetition | ||||
| scheduled repetition interval | last repetition or drill |