1
I have a system that registers personal data enc_dados_pessoais
and another table that stores complementary data enc_dados_complementares
.
In the table personal data the user registers only the basic information and by clicking on move forward, goes to complementary data. I need to list only users who have not completed the complementary data.
To primary key table enc_dados_pessoais
is IdUsuarios
and the foreign key table enc_dados_complementares
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 who did not fill out, only who filled out the complementary data.
I’ve tried to use INNER JOIN
, RIGHT JOIN
and JOIN
, but it didn’t work either.
you can use not exists or not in. Have a look here. http://answall.com/questions/62925/not-in-ou-not-exists-qual-use
– Marconi
Thanks Marconi. I used not in and it worked perfectly.
– user24136
Not at all @Jose.Marcos
– Marconi