PABX da Simples IP
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.
 
 
 
 
 
 

31 lines
703 B

select *
from pbx_classifica_reg
where data_reg::date = now()::date
and id_dac is null
select *
from pbx_classifica_reg
where id_dac is null
begin
update pbx_classifica_reg
set id_dac = (select id from pbx_dacs where nome = b.fila)
from pbx_classifica_reg a, pbx_eventos_dacs b
where b.uid2 = a.id_bilhetes
and a.id_dac is null
and b.evento = 'CONNECT'
commit
rollback
update pbx_classifica_reg
set contrib_id = null
where id_dac is null
select * from pbx_classifica_reg where id_bilhetes in (select uid2 from pbx_eventos_dacs)
delete from pbx_classifica_reg where id_bilhetes not in (select uid2 from pbx_eventos_dacs)
update pbx_classifica_reg