Binu
Binu

Reputation: 1403

Retrieve group of data in the row to columns

EmpId   X   Y

U27     1   1
U28     1   2
U29     1   3
U30     2   1
U31     2   2
U32     2   3
U33     3   1
U34     3   2
U35     3   3

I have a Table of data shown above.I want to retrieve the data like shown below

U27 U28 U29
U30 U31 U32
U33 U34 U35

Please give your suggestions and ideas do resolve this problem Thanks Binu Venu

Upvotes: 0

Views: 68

Answers (1)

Mikael Eriksson
Mikael Eriksson

Reputation: 139010

select [1], [2], [3]
from YourTable
pivot (min(EmpId) for Y in ([1], [2], [3])) as p

Try here on SE-Data

Upvotes: 2

Related Questions