扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:开发者在线 来源:开发者在线 2007年7月27日
关键字: ORACLE
在本页阅读全文(共3页)
Listing B
col order_total format 999,999.00
col pct_total format 999.00
SELECT
sales_rep_id,
customer_id,
order_total,
ROUND(100*ratio_to_report(order_total)
OVER (PARTITION BY customer_id),2) pct_total
FROM
orders
WHERE
sales_rep_id = 163
ORDER BY
sales_rep_id, customer_id, order_id/
SQL> @ratioreport_b
SALES_REP_ID CUSTOMER_ID ORDER_TOTAL PCT_TOTAL
------------ ----------- ----------- ---------
163 102 5,610.60 34.78
163 102 10,523.00 65.22
163 103 78.00 .57
163 103 13,550.00 99.43
163 105 1,926.60 100.00
163 106 5,546.60 100.00
163 117 3,878.40 100.00
163 147 1,500.80 100.00
163 149 9,055.00 100.00
163 156 68,501.00 100.00
163 157 7,110.30 100.00
163 160 969.20 100.00
12 rows selected.
SQL> spool off
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。