select
x.column1,
x.column2,
x.column3
from
(select
t2.column1,
t2.column2,
t2.column3,
dense_rank() over (partition by t2.column1, t2.column2 order by t2.column3) as rank
from
table1 t1
inner join table2 t2 on t2.column2 = t1.column1) x
where
x.rank = 1
But since you're not using any fields from t1, you may leave out the join. It could be used for filtering (which could just as well be done by using exists
, but since t1 is the parent table, all records in t2 should have a matching t1 record anyway.