I\'m trying to delete orphan posts in my database and I have created this query:
DELETE post.*
FROM foro_post AS post
LEFT JOIN foro_thread AS th
You can't use LIMIT
directly within DELETE when you're referencing multiple tables at the same time, but you can get around that by encasing what you want to delete within a subselect:
DELETE po
FROM foro_post po
JOIN (
SELECT p.postid
FROM foro_post p
LEFT JOIN foro_thread t ON p.threadid = t.threadid
WHERE t.threadid IS NULL
ORDER BY p.postid
LIMIT 50
) pp ON po.postid = pp.postid