I have simplified my data to something much like the following:
+---------+-----+--------+
| item | type | color |
+-------+-------+--------+
| 1 | A | red |
| 1 | B | blue |
| 2 | A | orange |
| 2 | B | pink |
| 2 | C | blue |
| 3 | B | yellow |
+---------+-----+--------+
The number of 'type' per item is variable, therefore, I need a MySQL pivot solution that is dynamic and can handle any number of types. The following is the kind of result set I need to return from the MySQL query. As you can see, I do not need a summary calculation.
+---------+------+--------+--------+
| item | A | B | C |
+-------+--------+--------+--------+
| 1 | red | blue | |
| 2 | orange | pink | blue |
| 3 | | yellow | |
+-------+--------+--------+--------+
I suspect the solution may involve the use of a MySQL procedure?