List Items from One Table Who's ID doesn't appear in another

G’day Everyone,

Just wondering if there is an SQl Guru out there that can help with this query.

I have 2 tables:

TIMES: id, time
BOOKINGS: id, timesid, teacherid, studentid

I want to get all the times out of the TIMES table who’s id (timesid) does not appear in the BOOKINGS table

I have tried this but to no avail

SELECT times.ID FROM times
INNER JOIN bookings ON = bookings.timesid

I wait in hope!


That is Brilliant!!! exactly what I needed


you were close, but you need a LEFT OUTER JOIN instead

SELECT times.ID 
  FROM times
  JOIN bookings 
    ON bookings.timesid =
 WHERE bookings.timesid IS NULL