$db->beginTransaction();
$del = $db->prepare('DELETE FROM hesabat_filter WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_istilik WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_nem WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_rek WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_soyuqluq WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$del = $db->prepare('DELETE FROM hesabat_vent WHERE model_id NOT IN (SELECT res_id FROM result)');
$del->execute();
$db->commit();
$count = $del->rowCount();
echo $count;
尽管此 PDO 工作正常,但我无法计算所有已删除的行。我认为我应该为每个准备好的查询提供不同的变量,然后收集变量。你的想法是什么?