Wednesday, March 7, 2012

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,
KnutYou need to use DECODE for the purpose.

No comments:

Post a Comment