I want to change this so orders.total is a sum by order.id Something with "sum(orders.total) as total". How do I change this?
select c.name
from cust c
inner join orders
on c.id=orders.id
left join flags
on c.id=flags.id
where orders.order_date > '1/1/2007'
and orders.total>20
and flags.flag_1=1
and c.price_cat='01'
select c.name
from cust c
inner join orders
on c.id=orders.id
left join flags
on c.id=flags.id
where orders.order_date > '1/1/2007'
and orders.total>20
and flags.flag_1=1
and c.price_cat='01'