CodePudding user response:
https://bbs.csdn.net/topics/390676351CodePudding user response:
Small SUM function with GROUP BY:
SELECT goods number, the SUM (quantity), SUM (sales),...
FROM the table
GROUP BY commodity number;
If you also need to calculate total, plus WITH ROLLUP:
SELECT goods number, the SUM (quantity), SUM (sales),...
FROM the table
GROUP BY commodity code WITH a ROLLUP;