Conditions on groups
Example: Find customers owing more that $100
Could use a subquery, (in
the from clause):
select name, address, sum_unpaid
from (
select name, address, sum(unpaid) as sum_unpaid
from purchase join customer using (customer_id)
group by customer_id, name, address) q
where sum_unpaid > 100
|