Don't this satisfy your requirement? (This isn't tested. There may be some syntax error.) DELETE FROM your_table T WHERE uid > (SELECT MIN(uid) FROM your_table M WHERE M.somevalue = T.somevalue ) ; The result I expected is: SELECT * FROM your_table; uid|somevalue -------------------- 1|11 3|31 6|33 2|44 5|71 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match