Mohli byste se vyhnout dočasné tabulce a loopin mysql, můžete je odstranit ze dvou tabulek v jediném dotazu a pro dočasná data použít sunquery
DELETE t1, t2
FROM AppCoverLetter t1
INNER JOIN (
SELECT AppId
FROM ApplyData.AppFormData
where lower(Email) = lower(_email_)
) t3 ON t1.AppID = t3.AppId
INNER JOIN AppError t2 ON t2.AppID = t3.AppId;
nebo pokud máte více stolů
DELETE t1, t2, tx
FROM AppCoverLetter t1
INNER JOIN (
SELECT AppId
FROM ApplyData.AppFormData
where lower(Email) = lower(_email_)
) t3 ON t1.AppID = t3.AppId
INNER JOIN AppError t2 ON t2.AppID = t3.AppId
INNER JOIN table3 tx ON tx.AppID = t3.AppId;