我有一个这样的mysql表:
general
+----+------+
| ID | hits |
+----+------+
| 1 | 10 |
+----+------+
| 2 | 6 |
+----+------+
| 3 | 31 |
+----+------+
我怎样才能获得点击总数?
我有一个这样的mysql表:
general
+----+------+
| ID | hits |
+----+------+
| 1 | 10 |
+----+------+
| 2 | 6 |
+----+------+
| 3 | 31 |
+----+------+
我怎样才能获得点击总数?
使用SUM
聚合函数获取列的总数:
SELECT SUM(hits) FROM general
SELECT SUM(hits) FROM general;