Help with pivot table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kho
    New Member
    • Nov 2007
    • 1

    Help with pivot table

    Hi!

    I`ve been struggling to find a solution to make a report from MS SQL, and I think pivot table is the key but I`m not sure on how to do this. Hope someone can help, here is the case :

    I have one table "Products" and one table "Packages". Every product in the Products table has 1 - * Packages (unit which the product is sold by)

    The Products table looks something like this :

    Id | productText | productGroup | etc

    And the Packages table like this :

    Id | productId | packageType | weight | etc

    What I want to do is to flat this out so I can get the Product and all it`s packages in one record. Something like this :

    productText | productGroup | packageType | weight | packageType | weight | etc.

    I would really appriciate if someone could help me out with this.

    Regards,
    Knut
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to use DECODE for the purpose.

    Comment

    Working...