Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. create index on tmp(cpf_cnpj);
  2. create index on cliente_telefone(cpf_cnpj);
  3. create index on cliente_telefone(id_telefone,cpf_cnpj);
  4. create index on telefone(id_telefone);
  5.  
  6. select b.cpf_cnpj,
  7. b.ddd,
  8. b.numero,
  9. 'bom' as id_resultado
  10. from tmp as b
  11. left join cliente_telefone as ct on ct.cpf_cnpj = b.cpf_cnpj
  12. inner join telefone as t on t.ddd = b.ddd and t.numero = b.numero
  13. where
  14. b.status in ('BESTFONE', 'Bom') and
  15. ct.id_telefone is null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement