 <p>Something like this?</p> <pre><code>select a.col1, a.col2, a.col3, b.colC from ( select row_number() over (partition by col1, col2 order by 1) r, col1, col2 from table1 ) a, ( select row_number() over (partition by col1, col2 order by 1) r, col1, col2 from table2 ) b where a.r = b.r and a.col1 = b.col1 and a.col2 = b.col2; </code></pre>