简体   繁体   中英

Count values in mysql database rows

I have a table in my database that looks like this.

id    count
-----------
1      23
2      20
3      12
4      4

The "count" column will periodically change. How would I add all the values in the count column and display them on the front end? So for example, in this case they would add up to 59.

select sum(count) from table_name
SELECT SUM(`count`) FROM myTable

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