I need to remove duplicate meta_values from a table where the duplicate values share the same post_id. An import went wrong and there’s several hundred thousand rows with a lot of duplicate values.
So in the example below there are two rows with post_id 12 and meta_value of 6 when there should only be one.
meta_id post_id meta_key meta_value
------- ------- -------- ----------
1 12 attribute_pa_length 6
2 12 attribute_pa_length 6
3 12 attribute_pa_length 9
4 35 attribute_pa_length 8
5 35 attribute_pa_length 12
This will leave you with the smaller
meta_id