I have a table with customers and another with documents, I want to get all customers that don’t are in the subquery having document type 2
SELECT * from contactos
WHERE NOT EXISTS
(SELECT * from contactos
JOIN documentos ON documentos.cifnif = contactos.cifnif
WHERE documentos.idramo = 2 AND documentos.estado = ‘Vigente’)
There are 5000 customers and only 845 on the subquery
But I got an empty result.