This may do what you want:
DELETE rs
FROM report_sections rs LEFT JOIN
report_pre rp
on rp.id = rs.report
WHERE rp.id IS NULL;
This will delete all rows from report_sections
that don't have a matching record in report_pre
.
I think the error message is pretty clear on your original message. You can work around it by using an additional layer of subqueries. But, it is fun to learn the join
method to get around this problem.