Here's an approach to delete all revisions except the last one (I know its not what was asked originally but I hope this helps somebody to use a similar solution).
Step 1. Create temporary table with the revisions that you want to keep:
DROP TABLE IF EXISTS t_keep_revisions;
CREATE TEMPORARY TABLE t_keep_revisions AS (
MAX(p.ID) as ID,
FROM wp_posts p
WHERE p.post_type = 'revision'
GROUP BY p.post_parent
ORDER BY p.post_parent
Step 2. Delete all Revision Posts except those which ID is in the table created above
DELETE FROM wp_posts
WHERE post_type = 'revision'
AND ID NOT IN (
Step 3. Delete orphan metadata from wp_postmeta
DELETE FROM wp_postmeta
WHERE post_id NOT IN (
SELECT ID FROM wp_posts