how to get only those records that have more than one values? ID           Matches
1000029049 335xxx219597989 
1000029361 335xxx217190890 
1000031383 335xxx219826131 
1000031433 492xxx6557366 
1000031433 335xxx216660374 


I want to print only the ids that have different matches. 
E.g I want the below output.

ID           Matches
1000031433 492xxx6557366 
1000031433 335xxx216660374
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