Code Listing 3: Getting the SUM with joinback

SELECT t.month, p.category, SUM(ps.purchase_price) as sum_of_sales

FROM time t, product p, purchases ps
WHERE t.time_key = ps.time_key AND
      ps.product_id = p.product_id
GROUP BY t.month, p.category;


   Id    Operation                      Name              
__________________________________________________
    0    SELECT STATEMENT                                 
    1     SORT GROUP BY                                   
    2      HASH JOIN                                      
    3       TABLE ACCESS FULL            PRODUCT         

    4       MAT_VIEW REWRITE ACCESS FULL  MONTHLY_SALES_MV

Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy