product表中有三个字段price、type、ywsj通过group by typeywsj 对price进行求和最后增加一个合计所有类型的合计
SELECT type, ywsj, SUM(price) AS sum_price FROM product GROUP BY type, ywsj WITH ROLLUP;
原文地址: https://www.cveoy.top/t/topic/fTDh 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
SELECT type, ywsj, SUM(price) AS sum_price FROM product GROUP BY type, ywsj WITH ROLLUP;
原文地址: https://www.cveoy.top/t/topic/fTDh 著作权归作者所有。请勿转载和采集!