CREATE TABLE IF NOT EXISTS _tmp3 (id INT NOT NULL PRIMARY KEY);
INSERT INTO _tmp3 (id)
SELECT id
FROM yb_mv
WHERE id NOT IN (
SELECT maxid FROM
(SELECT max(id) AS maxid FROM yb_mv
GROUP BY file
) b
);
DELETE a FROM yb_mv as a INNER JOIN _tmp3 as b on b.id = a.id;
DROP TABLE _tm3