I have a query like this:
SELECT lesson.id, p1.first_name, p1.surname, start_time, instrument.name
FROM lesson, person AS p1, person AS p2, instrument, invoice_lesson
WHERE lesson.student = p1.id
AND lesson.teacher = p2.id
AND instrument.id = lesson.instrument_id
ORDER BY surname
However, I would like to modify it so that it only shows results where lesson.id
is not in the table invoice_lesson.lesson_id
. Is this a correlated query? How do I do this?