I have seen this issue in SF, but me being a noob I just can\'t get my fried brain around them. So please forgive me if this feels like repetition.
My Sample Table>
Standard SQL has no concept of 'what row number am I up to', so this can only be implemented using something called a cursor. Writing code with cursors is something like writing code with for loops in other languages.
An example of how to use cursors is here:
http://dev.mysql.com/doc/refman/5.0/en/cursors.html