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.
SELECT
Use an outer join
SELECT A.* FROM Table1 a LEFT OUTER JOIN (SELECT DISTINCT subject FROM Table2) b ON a.id = b.subject WHERE b.subject IS NULL