Advertisement

07.23.2008 at 10:22AM PDT, ID: 23589383
[x]
Attachment Details

create crosstab in SQL using PIVOT?

Asked by vzorn in SQL Server 2005

I have a sql view that has the following data.

OrderID   |  ProductID  |  Qty  |  Color |  Size  |
    1                 15            10        Blue      L
    1                  15            20       Blue      S

I need to get it into a view to look like this
OrderID    |  ProductID  |   Size1  |    Size2  |   Size3  |  Color  |   Size1Display  |  Size2Display |  Size3Display
     1                15                 20            10                           Blue             S                         L

Is this possible?  I have looked at PIVOT tables but not sure if this is a good solution.

Start Free Trial
[+][-]07.23.2008 at 11:32AM PDT, ID: 22072360

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:37AM PDT, ID: 22072410

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:44AM PDT, ID: 22072495

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:48AM PDT, ID: 22072540

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 12:36PM PDT, ID: 22073002

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Server 2005
Sign Up Now!
Solution Provided By: Zberteoc
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.23.2008 at 12:38PM PDT, ID: 22073018

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.11.2008 at 02:23PM PDT, ID: 22208417

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628