a guest Feb 22nd, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand