0

There are two table which am joining, but unable to find duplicates properly:

Below are 2 input tables:

Input table 1

Input table 2

Output required

Gordon Linoff
  • 1,122,135
  • 50
  • 484
  • 624

1 Answers1

1

It looks like you want to eliminate duplicates, which you can do using select distinct:

select distinct t1.id_number, t1.id, t2.id_type, t2.id_value
from table1 t1 join
     table2 t2
     on t2.id = t1.id;
Gordon Linoff
  • 1,122,135
  • 50
  • 484
  • 624
  • Suppose all the vendors are giving (ID_number =A, ID_value=apple) while there is one outlier vendor which gives (ID_number =B, ID_value=apple). Am searching for such cases where one ID_value is mapped to multiple ID_number. Since both the tables are combined with ID as common key. I tried below but can't get further select distinct id_number, id_value from table a, table b where a.id=b.id and id_value is not null group by id_number,id_value – Nemesi7000 Jul 18 '20 at 18:50
  • @Nemesi7000 . . . Your comment doesn't seem very related to the question that was asked. I would suggest that you ask a *new* question with appropriate sample data, desired results, and explanation of what you want to do. – Gordon Linoff Jul 18 '20 at 21:45