I have a table about call information. A call id, call flow such as when they answered, holds, etc, and the time stamps for each flow. I need a code that can search through each call id and run a calculation that returns in a new column, 'Time diff'. For Call ID 1, find Phone and Conference, then subtract the two values(12:08-12:05 = 3 min Not worried about formats now), then go to call ID 2, then 3, and so on. This may be a difficult thing to do in SQL. Note: There is also the possibility that there are more phones in the call, so I would want to subtract the last phone closest to the conference time. This condition can be ignored for now, I really just want to know if there is anyway to subtract conference and phone for now. Thanks.
Call_ID Flow Time Time Diff
1 Inbound 12:00 pm 3
1 Connect 12:01 pm 3
1 Answer 12:01 pm 3
1 Hold 12:04 pm 3
1 Phone 12:05 pm 3
1 Un-hold 12:07 pm 3
1 Conference 12:08 pm 3
1 Call Term 12:20 pm 3
2 Inbound 12:40 pm 2
2 Connect 12:40 pm 2
2 Answer 12:40 pm 2
2 Hold 12:43 pm 2
2 Phone 12:44 pm 2
2 Un-hold 12:46 pm 2
2 Conference 12:46 pm 2
2 Call Term 12:59 pm 2
3
.
.
.