开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜