I have three tables: - Customers - plans - services
In the services table I have servico_A, servico_B and servico_C that are listed in the plans table.
I need to list all clients that do not have a plan with service_C. Even though it has other plans with other services, it should not be listed.
SELECT
p.codcliente
FROM
planos p
LEFT JOIN servicos se ON p.codser = se.codser
LEFT JOIN clientes c ON p.codcliente = c.codcliente
WHERE
#ele nao tenha nenhum servico_C
ORDER BY p.codcliente