Code is not executing, syntax is completely correct. I don't understand
SELECT DWCUSTOMER.CUS_CODE, DWPRODUCT.P_CODE, SUM(DWDAYSALESFACT.SALE_UNITS*DWDAYSALESFACT.SALE_PRICE) AS TOTSALES
FROM DWDAYSALESFACT NATURAL JOIN DWCUSTOMER
GROUP BY ROLLUP (DWCUSTOMER.CUS_CODE, DWPRODUCT.P_CODE)
ORDER BY DWCUSTOMER.CUS_CODE, DWPRODUCT.P_CODE;
After execution: Incorrect syntax near the keyword 'GROUP'.
You didn't join the DWProduct table but you selected from it in the first line. Add another join and it should work fine.
尝试:
GROUP BY DWCUSTOMER.CUS_CODE, DWPRODUCT.P_CODE WITH ROLLUP
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.