You can use self-join using derived SQL. Once set with RANK and other set with RANK - 1.
Thank you very much,
Can you please elaborate more about the solution? Even with self join, how can I use the column that has not been created yet in the self-join, that is the RANK column in this example?
You may try to enumarate every single row. When you are done, try to group by the criterias you decide, so that's one way you can control what the preview row is and what the next one is.
DATE CODE ROW_N
12-10-2014 ABS0 1
12-11-2014 ABS0 2
11-10-2014 ABS0 3
12-10-2014 STT 1