Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SQL Pivot Help

Avatar of FamousMortimer
FamousMortimerFlag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008
8 Comments1 Solution630 ViewsLast Modified:
Hi Experts,

I have a table like this

Item# | Color |   Ink       |Sequence
123A   | blue   |   A234   | 1    
123A   | red    |    B235   |2
123A   | green|    C236   |3
124B   | red    |    A123   |1
124B   | white |    A124   |2

I would like the output to be like this:

Item# | Station1     | Station2    | Station3
123A   | Color: blue |Color: red | Color: green
              Ink: A234   | Ink: B235  |Ink: C236
124B   | Color: red  |Color: white| NULL
           |Ink: A123    |Ink: A124
The sequence can be anywhere from 1 to 10.

In the output table the color and ink are separated by CHAR(10) so there should be one line returned for each unique item #

Avatar of Patrick Matthews
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers