简体   繁体   中英

count sum of a column and group it by column with same value

how to select the sum of the number column and then group it with name

name | number
a    | 100
b    | 10
a    | 50
b    | 40
c    | 200
a    | 20

expected result :

name | number
a    | 170
b    | 50
c    | 200
SELECT name, 
SUM (number)
FROM tablename
GROUP BY name;

我明白了我很抱歉

SELECT NAME, SUM(NUMBER) AS NUMBER FROM TABLE GROUP BY NAME

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM