我在 mysql 中有一个表,例如
| service_code | charges | caller_number | duration | minutes |
+--------------+---------+---------------+----------+---------+
| 10 | 15 | 8281490235 | 00:00:00 | 1.0000 |
| 11 | 12 | 9961621709 | 00:00:00 | 0.0000 |
| 10 | 15 | 8281490235 | 01:00:44 | 60.7333 |
| 11 | 2 | 9744944316 | 01:00:44 | 60.7333 |
+--------------+---------+---------------+----------+---------+
从这个表中,我想获取每个单独的调用者号码的费用*分钟。 我已经这样做了
SELECT sum(charges*minutes) as cost from t8_m4_bill groupby caller_number
但我没有得到预期的输出。请帮忙?
最佳答案
SELECT caller_number,sum(charges*minutes) as cost
from t8_m4_bill
group by caller_number
order by caller_number
关于mysql - 如何获取mysql中不同条目的总和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31260459/