This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cheatsheets:sql [2017/03/23 17:23] admin |
cheatsheets:sql [2020/06/13 20:09] (current) |
||
---|---|---|---|
Line 70: | Line 70: | ||
SELECT Country, SUM(InvoiceTotal) AS Revenue FROM Customer GROUP BY Country HAVING Revenue > 300 | SELECT Country, SUM(InvoiceTotal) AS Revenue FROM Customer GROUP BY Country HAVING Revenue > 300 | ||
+ | |||
+ | * For countries with more than 4 customers display their name alongside the revenue they generate. | ||
+ | |||
+ | SELECT Country, SUM(InvoiceTotal) FROM Customer GROUP BY Country HAVING COUNT(CustomerId) > 4 |