Хочу удалить повторения по колонкам post_id, meta_key
DELETE `t1`.* FROM `table` AS `t1`
LEFT JOIN (SELECT `ID` FROM `table` GROUP BY `post_id`, `meta_key` ORDER BY `ID` DESC) AS `t2`
ON `t1`.`ID` = `t2`.`ID`
WHERE `t2`.`ID` IS NULL ORDER BY `t1`.`ID` DESC;
CREATE TEMPORARY TABLE `t_temp`
as (
SELECT MAX(ID) as ID
FROM `table`
GROUP BY post_id, meta_key
);
DELETE from `table`
WHERE `table`.ID not in (
SELECT ID FROM t_temp
);