Reputation: 13
I have table contain call durations of a telecom company.
ex: Table 1
| callerid | receiverid | call duration
| 1 | 2 | 5
| 1 | 2 | 2
| 2 | 3 | 4
| 1 | 5 | 2
i need to query above table so the result table after query:
Table 2
| callerid | receiverid | call duration
| 1 | 2 | 7
| 2 | 3 | 4
| 1 | 5 | 2
Upvotes: 1
Views: 68
Reputation: 173046
use below
select callerid, receiverid, sum(call_duration) call_duration
from your_table
group by callerid, receiverid
if applied to sample data in your question - output is
Upvotes: 1