I have an excel with VBA program which connects to MySQL database to retrieve some information. Initially, when the program loads I have the below query.
Similar to the other offered answer, however the query may perform better with a direct link to the table rather than to an inline view on a SELECT DISTINCT:
SELECT t1.*
FROM Table1 t1
LEFT JOIN Table2 t2 ON t1.id = t2.subject
WHERE t2.subject IS NULL