简体   繁体   English

计数mysql数据库行中的值

[英]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? 如何将所有值添加到count列中并在前端显示它们? So for example, in this case they would add up to 59. 因此,例如,在这种情况下,它们的总和为59。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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