I think you're missing some of your code. I only see one delete query.
I would suggest that if you have two related tables and the PKs are different, that you make a third table to relate the two. This will let you look up one id from the other, which will make running the second delete query easier. If you create a foreign key relationship between this new table and the other tables, you can set the records to 'ON DELETE CASCADE', which will automatically remove the child rows. Alternatively, you could just add a third delete query to delete from the new table.