在 codeiginter 中 - 是否可以使用 Active 记录从 mySQL 中的结果汇总总数?
我的桌子:
+-----------------+---------------+----------+
| transaction_ID | category_ID | amount |
+-----------------+---------------+----------+
| 1 | 2 | 5.0 |
+-----------------+---------------+----------+
| 2 | 1 | 6.0 |
+-----------------+---------------+----------+
| 3 | 2 | 4.1 |
+-----------------+---------------+----------+
| 4 | 3 | 1.2 |
+-----------------+---------------+----------+
| 5 | 1 | 7.0 |
+-----------------+---------------+----------+
我想达到的目标:
+---------------+----------------+
| category_ID | total_amount |
+---------------+----------------+
| 1 | 13.0 |
+---------------+----------------+
| 2 | 9.1 |
+---------------+----------------+
| 3 | 1.2 |
+---------------+----------------+