ITPub博客

首页 > 应用开发 > IT综合 > analyze function (RATIO_TO_REPORT)

analyze function (RATIO_TO_REPORT)

原创 IT综合 作者:jasamin 时间:2005-08-02 19:08:21 0 删除 编辑

Analyzer explains what need to do.

the first SQL looks terse, but the pct will always equal 1.

change to SQL 2, note the join relationship.

update employees e1
set pct = (select RATIO_TO_REPORT(salary) OVER () AS rr
from employees e2
WHERE e1.employee_id = e2.employee_id
)
WHERE job_id = 'PU_CLERK';

-->

update employees e1
set pct = (select aaa.rr from (select employee_id, rowid, RATIO_TO_REPORT(salary) OVER () AS rr
from employees
WHERE job_id = 'PU_CLERK') aaa
where e1.employee_id = aaa.employee_id
)
WHERE job_id = 'PU_CLERK';

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17739/viewspace-803736/,如需转载,请注明出处,否则将追究法律责任。

上一篇: XA support
下一篇: thorn birds
请登录后发表评论 登录
全部评论
  • 博文量
    6
  • 访问量
    152450