select distinct a.* from temp_ids a join
(select name, max(col1 || ' ' || col2 || ' ' || col3) id
from temp_ids
where col1 = 2
group by name
) b
on (a.name = b.name and (col1 || ' ' || col2 || ' ' || col3) = b.id)
;
当然,最好使用唯一记录ID代替串联,但是可以生成ID。确保id的函数为每个列组合返回唯一值(在这种情况下使用(col1 ||’‘|| col2 ||’‘||col3))