I am trying to fetch all record that are not related to a certain member, registration is an intersection entity that solves the many to many for members to lessons.
SELECT * FROM lesson
INNER JOIN training
ON training.id = lesson.training_id
WHERE lesson.id
NOT IN (SELECT registration.lesson_id FROM registration WHERE registration.member_id = 42)
I have been trying to convert this code to use a join statement but for I just can't get it to work.
SELECT l.*
FROM t_left l
LEFT JOIN
t_right r
ON r.value = l.value
WHERE r.value IS NULL
this technique doesn't work since this returns record of lesson that don't have any relation ship at all, I need it to look if it doesn't have a relationship to a specific member.