'RATE'에 해당되는 글 1건

  1. [2009/11/03] [ORACLE] 분석함수 이용한 누적,합계,비율 구하기

[ORACLE] 분석함수 이용한 누적,합계,비율 구하기

[■DataBase/OO ORACLE OO]
테이블 table_123에서 점이 1100인 것의
 
select mngbr, cifno, jikwonno, janamt
, row_number() over(partition by jikwonno order by mngbr, cifno ) accum -- 직원별 순차번호
, sum(janamt) over(partition by jikwonno order by mngbr, cifno rows between unbounded preceding and current row) accum1  -- 점,직원별/ 고객번호순 잔액의 누적
, sum(janamt) over(partition by jikwonno) accum_tot  -- 점,직원별 잔액의 합계
, round(ratio_to_report(janamt) over(partition by jikwonno), 2)*100 ratio_tot -- 점,직원별 잔액이 차지하는 비율
from   table_123
where  mngbr = 1100

[출처] 오라클 분석함수 - 누적,합계,비율구하기 |작성자 아직이군


분석함수가 약한 나에게 한줄기 빛이되신 아직이군님께 감사드립니다.

크리에이티브 커먼즈 라이센스
Creative Commons License