-1

I have something like this:

student1 |  2015-10-01 |    100  |
student2 |  2015-10-02 |    75   |
student3 |  2015-10-03 |    90   |

and I want this:

Names    | 2015-10-01 | 2015-10-02 | 2015-10-03 |
Student1 |     100    |     -      |     -      |
Student2 |            |    75      |     -      |
Student3 |      -     |     -      |    90      |

By the way, dates are unlimited.

Unheilig
  • 16,196
  • 193
  • 68
  • 98

1 Answers1

0

i think you use GROUP BY to simulate a PIVOT:

SELECT Id, MAX(CASE WHEN Order = 1 THEN data END) data1, MAX(CASE WHEN Order = 2 THEN data END) data2 FROM TableA GROUP BY Id

Check Example: Click Here

Gausul
  • 265
  • 3
  • 16