Listing 3: Finding Hypothetical Rank


select RANK(100000)within group (order by product_sales desc) as HRANK from 
(select product_id, sum(sales_amt) as product_sales 
  from sales 

  where customer_id in
    (select customer_id from 
      (select customer_id,
      100 * CUME_DIST() over(order by sum(sales_amt) asc) as 
      cust_percentile

      from sales group by customer_id)
    where cust_percentile > 85)
  group by product_id);

HRANK
-----

    7


E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy