我有一个像这样的mysql表:
general
+----+------+
| ID | hits |
+----+------+
| 1 | 10 |
+----+------+
| 2 | 6 |
+----+------+
| 3 | 31 |
+----+------+
如何获得总点击数?
答案 0 :(得分:4)
使用SUM
聚合函数获取列的总数:
SELECT SUM(hits) FROM general
答案 1 :(得分:1)
SELECT SUM(hits) FROM general;