본문 바로가기
Oracle

[윈도우 함수] ratio_to_report로 특정 비율 구하기

by 캡틴노랑이 2015. 7. 29.
반응형
select
  bb.last_name
, sum(aa.order_total)
, round(ratio_to_report(sum(aa.order_total)) over (partition by to_char(aa.order_date, 'YYYY')),2) aa
from orders aa
left outer join employees bb on aa.sales_rep_id = bb.employee_id
where to_char(aa.order_date, 'YYYY') = '2008'
group by bb.last_name, to_char(aa.order_date, 'YYYY')
order by bb.last_name;

 

반응형

댓글