Sunday, 22 January 2017

HOW TO GET TOTAL SALES VOLUME PRODUCT WISE



BELOW QUERY FETCHES THE TOTAL SALES VOLUMES WITH RESPECT TO PRODUCT ID


SELECT PRODUCT_ID ,
YEAR, QUANTITY,
SUM(QUANTITY) OVER (PARTITION BY PRODUCT_ID ORDER BY PRODUCT_ID) TOTAL_SALES_PRODID
FROM SALES;



BELOW QUERY FETCHES THE TOTAL SALES VOLUMES WITH RESPECT TO YEAR

SELECT YEAR,PRODUCT_ID ,
QUANTITY,
SUM(QUANTITY) OVER (PARTITION BY  YEAR ORDER BY YEAR) TOTAL_SALES_PRODID

FROM SALES;




No comments:

Post a Comment