Oops, I should have mentioned that. I don't know of anyway to write a single query in MySQL that will do this. The only option that I can think of right now is to select everything from table2 then build a comma separated list for the delete query.
select id from table2;
//using above dataset build delete query
delete * from table1 where id not in (1,3,4);
Where 1,3,4 is the data from the first query.