Ok, so here is an existing query I have that does what I need.
SELECT C1.id AS id, C1.title AS title, C1.instructor_id AS instructor_id,
C1.description AS description, C1.date AS date, C1.starttime AS starttime,
C1.endtime AS endtime, C1.training_id AS training_id, C2.name AS name,
C2.id AS instructors_id
FROM trainings C1
LEFT JOIN instructors C2 ON C1.instructor_id = C2.id
However, I need to add something to it. I have two tables I need to compare in addition to what I have.
Table ‘trainings’ has a list of training sessions, indexed by ‘id’. I also have another table, ‘registrations’, that holds info about what users registered for what training sessions with 3 columns: ‘id’ – index, ‘user_id’ – the ID of the user that registered for a training, and ‘course_id’ – the ID of the training session.
What I need to do in addition to my existing query, is select ONLY the training sessions that do not have a row in ‘registrations’ for that user already.
I hope this makes sense. Thank you for who can help. I have tried for hours. The query is just too large for me to keep organized and to think properly about how to do it.
Basicly just
JOINthat aswell, and filter it through aWHERE ... IS NULLsinceLEFT JOINwill return joined table’s columns asNULL.