I realise this question has been asked before in many forms but I am struggling to apply every answer I've found to my specific table. To start - straight to the details.
Table A has four columns (Unique ID, Number, Revision, Date). When executing a select * from A, the result set is as follows -
ID | Number | Revision | Date
------------------------------------
01 | 12345 | 1 | 01/01/2010
02 | 12345 | 2 | 01/04/2010
03 | 123 | 1 | 01/12/2010
04 | 1234 | 1 | 09/09/2012
05 | 12345 | 3 | 09/12/2012
I would like the dates for each Revision in a single row per Number, e.g. for Number 12345, the query would return
ID | Number | Revision | Date | Revision 2 | Revision 2 Date | Revision 3 | Revision 3 Date |
---------------------------------------------------------------------------------------------
01 | 12345 | 1 | 01/01/2010 |2 | 01/04/2010 | 3 | 09/12/2012|
I understand the syntax would be similar to
SELECT Revision, Date
FROM (
SELECT NUMBER
FROM A) as B INNER JOIN ON a.Number = B.Number
GROUP BY a.Number
However this still returns a row for each combination, I would like only the results shown above.
I would appreciate any suggestions or hints!