I was wondering if anyone had run into the following situation:

Code:
table_id | foreign_key1 | foreign_key2
I have rows that look like this:

Code:
1 | 1 | 2
1 | 1 | 3
..
The foreign_key2 is the unique value. What I would like to do is have a sequential count of where table_id and foreign_key1 are the same.

So for the above I would get something like:

Code:
1 | 1 | 2 | 1
1 | 1 | 3 | 2
In Oracle I could call the ROW_NUMBER() function. Is there anything similar to that in MySQL? My searches have only brought back stored procedures that won't work for my situation.