I have the SQL below and the parameter where the JOIN contratos co ON c.email != co.email
part is not working. My goal is that c.email
is not in the contracts table. No SQL error is shown.
If I do so JOIN contratos co ON c.email = co.email
works perfectly ... but I want the opposite result.
SELECT os.osID, c.nome, c.email, os.idioma, os.dataAtualizacao
FROM os JOIN cadastroCliente c ON os.idcliente = c.cadastroClienteID AND c.email != '' JOIN contratos co ON c.email != co.email
WHERE os.status = '1'
AND os.respondido = '1'
AND os.emailAutRecuperar1 = '0'
AND os.dataAtualizacao < CURRENT_DATE()-3 GROUP BY osID
I've tried it in a different way but it's also unsuccessful.
SELECT os.osID, c.nome, c.email, os.idioma, os.dataAtualizacao
FROM os, contratos co JOIN cadastroCliente c ON os.idcliente = c.cadastroClienteID AND c.email != ''
WHERE os.status = '1'
AND os.respondido = '1'
AND os.emailAutRecuperar1 = '0'
AND os.dataAtualizacao < CURRENT_DATE()-3 AND c.email != co.email GROUP BY osID