 <p>I might have simplified my example a little to much. The data in A,B,C might be non-numeric and not sorted and so forth.</p> <p>I found last_value() <a href="http://www.oracle.com/technetwork/issue-archive/2006/06-nov/o66asktom-099001.html" rel="nofollow">http://www.oracle.com/technetwork/issue-archive/2006/06-nov/o66asktom-099001.html</a> fit very well with this which would return:</p> <pre> A B C | Id 1 2 3 | 1 1 4 5 | 1 1 4 6 | 1 </pre> <p>for me to operate furhter on.</p> <p>Then the query looks something like this:</p> <pre><code>select distinct last_value(a ignore nulls) over (order by id) a, last_value(b ignore nulls) over (order by id) b, last_value(c ignore nulls) over (order by id) c from datatable where datatable.id IN (select id from datatable where datatable.id = 1) </code></pre>