MySQL Group by SUM
I have category in a table like
table(cat_name,amount);
How to get 开发者_StackOverflowthe sum of amount
each cat_name
Grouped by 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
精彩评论