Generating a sequence of values How can I change 2,2,2,1,2 into 201,202,203,101,204 in MySQL?

I have a table with data in the format of:

+---+---+---+
| U | C | R |
+---+---+---+
| 1 | 2 | 1 |
| 1 | 2 | 2 |
| 1 | 2 | 3 |
| 1 | 1 | 4 |
| 1 | 2 | 5 |
+---+---+---+


I am looking for a query to turn it into:

+---+-----+---+
| 1 | 201 | 1 |
| 1 | 202 | 2 |
| 1 | 203 | 3 |
| 1 | 101 | 4 |
| 1 | 204 | 5 |
+---+-----+---+


I have a query that is sort of what I am looking for:

SELECT U , C , group_concat( R ORDER BY R )
FROM table
GROUP BY U, C


But this is what I get back:

U-C-R
1-1-1, 2, 3, 5
1-2-4
With MyISAM, you can get an AUTO_INCREMENT that starts over with each new value.

CREATE TABLE foo (
    C INT UNSIGNED NOT NULL,
    N INT UNSIGNED NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(C,N)
  ) ENGINE=MyISAM;
INSERT INTO foo (C)
    SELECT C FROM your_table;


Then...

SELECT 100*C + N FROM foo


gives you the desired numbers.  (If you need U and R, add them to foo, etc.)

If this is a 1-time task, then give that a try.  If you need the numbering to be on-going, then it gets messier.