FROM Table1 t INNER JOIN Table2 s ON case when t.number = s.number then 1 when t.letter = s.letter then 1 else 0 end = 1