Temp tables are really messy... I know I've built them in the past to handle mysql. Its WAY easier to do it in php either by using arrays or just by a little ingenuity. Try this:
select id from tableb where data = criteria
then:
for each id in that query build a string:
$deletestring =(id1,id2,id3,id4)
then write your delete:
delete from tablea where id in $deletestring
Of course id is the foreign key in tablea that matches tableb.
thats pretty much what any query nesting in any database does anyway.
sm