kirychuk

Untitled

Sep 2nd, 2022
1,128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select h.user_id,
  2.            count(*) filter ( where cq.type = 1 and h.bridged_at isnull and h.parent_id notnull and h.hangup_by = 'B' ) "abandoned agent inbound queue"
  3.     from call_center.cc_calls_history h
  4.         left join call_center.cc_queue cq on h.queue_id = cq.id
  5.         left join call_center.cc_member_attempt_history cc on cc.agent_call_id = h.id
  6.     where h.domain_id = $domain_id and h.created_at between $__timeFrom()::timestamptz and $__timeTo()::timestamptz
  7.         and h.user_id in (
  8.             select distinct agents.user_id
  9.             from agents
  10.         )
  11.     group by h.user_id
Advertisement
Add Comment
Please, Sign In to add comment