我在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 |
+--------------+---------+---------------+----------+---------+
从这张表中我想得到每个单独的caller_number的费用*分钟。
我这样做了
SELECT sum(charges*minutes) as cost from t8_m4_bill groupby caller_number
但我没有得到预期的输出。请帮帮忙?
答案 0 :(得分:1)
SELECT caller_number,sum(charges*minutes) as cost
from t8_m4_bill
group by caller_number
order by caller_number