-1

我有一个这样的mysql表:

general
+----+------+
| ID | hits |
+----+------+
| 1  |  10  |
+----+------+
| 2  |  6   |
+----+------+
| 3  |  31  |
+----+------+

我怎样才能获得点击总数?

4

2 回答 2

4

使用SUM聚合函数获取列的总数:

SELECT SUM(hits) FROM general
于 2012-04-08T18:26:40.957 回答
1
SELECT SUM(hits) FROM general;
于 2012-04-08T18:29:13.267 回答