Click here to Skip to main content
15,353,432 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am having a table with data in the following format:
ID Val1 Val2 Amount
Item1 2 3 1
Item1 4 5 2
Item1 6 7 3
Item2 1 3 1
Item2 4 6 2
Item2 5 7 3
Item3 1 4 1
Item3 5 8 2
Item3 9 12 3
Item4 0 2 1
Item4 3 5 2
Item4 6 8 3

I need the result as:

ID 1_Val1 1_Val2 2_Val1 2_Val2 3_Val1 3_Val2
Item1 2 3 4 5 6 7
Item2 1 3 4 6 5 7
Item3 1 4 5 8 9 12
Item4 0 2 3 5 6 8

How can i obtain this?

Thank you.
Posted
Comments
Zukiari 9-Apr-14 7:48am
   
Hi,
Thank you for the answer.

1 solution

For much clear understanding of Pivote check this?

Pivote In SQL[^]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900