I have two tables: teacher_lm and teacher. These tables have both the column "teacher_email"
What I need is to get the emails that are present in teacher_lm but not in teacher.
I have 2 different approaches to solve this, but I don't understand why one of them doesnt give any result and the other one returns a lot of rows.
First one: 842 rows
SELECT DISTINCT lm.teacher_email
FROM teacher_lm as lm
WHERE NOT EXISTS (SELECT * FROM teacher as lt
WHERE lt.teacher_email = lm.teacher_email
)
Second one: no results
SELECT DISTINCT lm.teacher_email FROM
teacher_lm AS lm
WHERE lm.teacher_email NOT IN
(SELECT lt.teacher_email FROM
teacher AS lt)
Could you tell me what I'm doing wrong here, and what's the best way to do this?
Thank you.