MySQL的SUM组
我有类似的表格
表 (cat_name,amount);
如何获得每个cat_name
的总和由cat_name
分组
SELECT cat_name, SUM(amount) AS total_amount FROM table GROUP BY cat_name
SELECT cat_name, SUM(amount) AS TotalAmount FROM Table GROUP BY cat_name
我有类似的表格
表 (cat_name,amount);
如何获得每个cat_name
的总和由cat_name
分组
SELECT cat_name, SUM(amount) AS total_amount FROM table GROUP BY cat_name
SELECT cat_name, SUM(amount) AS TotalAmount FROM Table GROUP BY cat_name