forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
40 lines
1.5 KiB
2 years ago
|
select b.fila, cast(a.calldate as date) as data, date_part('hour', calldate) as hora, a.src as origem, count(*) as qtde, sum(param3::integer) as tempo
|
||
|
from pbx_bilhetes a, pbx_eventos_dacs b
|
||
|
where b.uid2 = a.uniqueid
|
||
|
and b.evento = 'ABANDON'
|
||
|
and a.lastapp <> 'Transferred Call'
|
||
|
and cast(a.calldate as date) >= '2011-08-10'
|
||
|
and cast(a.calldate as date) <= '2011-08-10'
|
||
|
and b.fila = 'SefazNivel1'-- (select nome from pbx_dacs where id = '64')
|
||
|
group by b.fila, cast(a.calldate as date), date_part('hour', calldate), a.src
|
||
|
order by 1, 2
|
||
|
|
||
|
|
||
|
--select * from pbx_dacs "SefazNivel1"
|
||
|
|
||
|
|
||
|
select a.dac_padrao from pbx_usuarios a, pbx_dacs b where b.id = a.dac_padrao and a.id = 234
|
||
|
|
||
|
select dac_padrao, * from pbx_usuarios where dac_padrao is null
|
||
|
|
||
|
select * from pbx_dac_usuario where id_usuario in(select id from pbx_usuarios)
|
||
|
|
||
|
select a.dac_padrao
|
||
|
begin
|
||
|
update pbx_usuarios
|
||
|
set dac_padrao = b.id_dac
|
||
|
from pbx_usuarios a, pbx_dac_usuario b
|
||
|
where b.id_usuario = a.id
|
||
|
and b.padrao = true
|
||
|
and a.dac_padrao is null
|
||
|
|
||
|
rollback
|
||
|
|
||
|
select *
|
||
|
from pbx_usuarios a, pbx_dac_usuario b
|
||
|
where b.id_usuario = a.id
|
||
|
and b.padrao = true
|
||
|
and a.dac_padrao is null
|
||
|
|
||
|
|
||
|
|