how to get only those records that have more than one values?
You need to group and join to the aggregation

select t1.*
from the_table t1
  join (
    select id
    from the_table 
    group by id
    having count(distinct matches) &gt; 1
  ) t2 on t1.id = t2.id