Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create index on tmp(cpf_cnpj);
- create index on cliente_telefone(cpf_cnpj);
- create index on cliente_telefone(id_telefone,cpf_cnpj);
- create index on telefone(id_telefone);
- select b.cpf_cnpj,
- b.ddd,
- b.numero,
- 'bom' as id_resultado
- from tmp as b
- left join cliente_telefone as ct on ct.cpf_cnpj = b.cpf_cnpj
- inner join telefone as t on t.ddd = b.ddd and t.numero = b.numero
- where
- b.status in ('BESTFONE', 'Bom') and
- ct.id_telefone is null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement