SELECT column_a FROM table_a WHERE id IN (SELECT table_a_id FROM table_b);
SELECT DISTINCT column_a FROM table_a, table_b WHERE table_a.id = table_b.table_a_id;
SELECT column_a FROM table_a WHERE id NOT IN (SELECT table_a_id FROM table_b);
SELECT column_a FROM table_a LEFT JOIN table_b ON table_a.id = table_b.table_a_id WHERE table_b.table_a_id IS NULL;
MySQL does not allow to use a table in a subquery if that table is going to be updated.
SELECT DISTINCT column_a FROM table_a, table_b WHERE table_a.id = table_b.table_a_id;
SELECT column_a FROM table_a WHERE id NOT IN (SELECT table_a_id FROM table_b);
SELECT column_a FROM table_a LEFT JOIN table_b ON table_a.id = table_b.table_a_id WHERE table_b.table_a_id IS NULL;
MySQL does not allow to use a table in a subquery if that table is going to be updated.