mysql分组之后再求和 测试数据 SELECT COALESCE(type,'all'), SUM(price) FROM products GROUP BY type WITH ROLLUP; 执行效果 扫描小程序二维码方便阅读