I have a system from which I register the personal data enc_dados_pessoais
and another table that stores complementary data enc_dados_complementares
.
In the personal data table, the user registers only the basic information and clicking next , goes to the complementary data. I need to list only the users who did not finalize the supplementary data.
The primary key of the enc_dados_pessoais
table is IdUsuarios
and the foreign key of the enc_dados_complementares
table is IdUsuarios
. So I did it this way:
SELECT * FROM enc_dados_principais princ LEFT JOIN enc_dados_complementares
comp ON princ.IdUsuarios <> comp.IdUsuarios;
But it is not returning those who did not fill, only those who filled in the supplementary data.
I have already tried to use INNER JOIN
, RIGHT JOIN
and JOIN
, but it also did not work.