What is the SQL command to list the total sales by customer and by product, with subtotals by customer and a grand total for all product sales? I tried...


What is the SQL command to list the total sales by customer and by product, with subtotals by customer and a grand total for all product sales?





 I tried



SELECT CUS_CODE,TM_MONTH,P_CODE,SUM(SALE_UNITS*SALE_PRICE) AS TOTSALES

FROM DWDAYSALESFACT JOIN DWTIME USING (TM_ID);

GROUP BY ROLLUP (CUS_CODE,TM_MONTH,P_CODE)


But got

ERROR 1140 (42000) at line 3: In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'Ch13_SaleCo_DW.DWDAYSALESFACT.CUS_CODE'; this is incompatible with sql_mode=only_full_group_by




Extracted text:

Jun 02, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here