delete from t
where
exists (
select true
from t tdouble
where
t.user_id = tdouble.user_id
and t.value_1 = tdouble.value_1
and t.value_2 > tdouble.value_2
);
with t as(
SELECT user_id, value_1, ROW_NUMBER () OVER (ORDER BY value_2) AS row_num FROM table group by user_id, value_1
)
delete from table using t where t.user_id = table.user_id and t.value_1 = table.value_1 and row_num>1