시소당
select a.br_name, sum(c.sal_amt*c.unit_price) sa sum_sale_amt
from branch a, custmer b, sale c
where a.br_no =b.br_no
and b.cust_no=c.cust_no
and c.saledate between ‘19951001’ and ‘19951231’
group by a.br_name;
<개선안1>
select b.br_name, sum(v.sum_sale_amt)
from (select cust_no, sum(sale_amt*unit_price) as sum_sale_amt
from sale
where saledate between ‘19951001’ and ‘19951231’
group by a, branch b) v, customer a, branch b
where b.br_no=a.br_no
and a.cust_no=v.cust_no
group by b.br_name;