MySQL Pivot? HELP

JerryMungo

Honorary Master
Joined
Jul 18, 2008
Messages
37,522
Reaction score
6,275
I have a table with the following data:
Code:
TableA

[B]ID |  result  |  date  
[/B]1  |    183   | 01/01/2013
1  |    442   | 02/01/2013
3  |    632   | 03/01/2013
2  |    932   | 04/01/2013
3  |    188   | 04/01/2013
1  |    322   | 07/01/2013
3  |    143   | 12/01/2013
2  |    322   | 12/01/2013
4  |    912   | 12/01/2013
3  |    847   | 14/01/2013
1  |    321   | 14/01/2013
2  |    432   | 18/01/2013
What I want is a query or something to output this:

Code:
ID |   Date1   | Result1  |   Date2   | Result2  |   Date3    | Result3   | ...etc
1  | 02/01/2013|   442    | 07/01/2013|   322    | 14/01/2013 |    321    |  ...etc
2  | 04/01/2013|   932    | 12/01/2013|   322    | 18/01/2013 |    432    |   ...etc

Is this even possible without resorting to managed code? Can it be done in MySQL?
 
Last edited by a moderator:
Top
Sign up to the MyBroadband newsletter
X