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.

30 lines
1010 B

select client_out_id, * from pbx_cliente where clo_id = 1 and client_status::int <> 21 and coalesce(client_out_id, 0) > 0;
update pbx_cliente set client_out_id = null where clo_id = 1 and client_status::int <> 21 and coalesce(client_out_id, 0) > 0;
begin
update pbx_cliente
set client_out_id = pbx_cliente_bk_prevenda.client_out_id
from pbx_cliente_bk_prevenda
where pbx_cliente.client_id = pbx_cliente_bk_prevenda.client_id
and pbx_cliente_bk_prevenda.clo_id = 1
and pbx_cliente_bk_prevenda.client_status::int <> 21
and coalesce(pbx_cliente_bk_prevenda.client_out_id, 0) > 0;
commit
rollback
/*
select * from pbx_cliente_bk_prevenda where clo_id = 1 and client_status::int <> 21 and coalesce(client_out_id, 0) > 0;
select * into pbx_cliente_bk_prevenda from pbx_cliente
select * from pbx_cliente_bk_prevenda
select ctst_ID, ctst_nome, count(*)
from pbx_cliente a, pbx_campanha_contato_status b
where b.ctst_id = a.client_status::int
group by ctst_ID, ctst_nome order by 1;
*/