in Chris post, if your table is big then second solution is always better, the consistent gets is much much smaller.

2 weeks ago I had a very similar query in a 5 millions rows table, with correlated query (indexed column) it took 17 minutes, with analytic functions 7 minutes with 10% consistent gets of correlated query