开发者

MySQL Group by SUM

开发者 https://www.devze.com 2023-03-08 09:05 出处:网络
I have category in a table like table(cat_name,amount); How to get 开发者_StackOverflowthe sum of amount each cat_name Grouped by cat_nameSELECT cat_name, SUM(amount) AS total_amount

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

精彩评论

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