Let me explain, I have a main table and an images table, I want to get the results from the main table that don't have an equivalent in the images table (hence entries without images).

This works:

Code MySQL:
SELECT primaryKey, title FROM bookpedia WHERE primaryKey NOT IN 
(SELECT DISTINCT a.`primaryKey`
FROM book_images a
GROUP BY a.`primaryKey`);

But is extremely slow.

A simple JOIN gets me the entries that have images so I thought that by negating it I could get the results a lot faster, but if I try to use the NOT keyword for a JOIN I get an error of course.

Thanks.