Question
How can I create a self join on a column in an OLAP table?
Hi Team,
I have the following situation:
1 column reflects product IDs and the other column are attributes of the product like color, size, etc.
Example:
I have the following table:
Ids
Attributes
1
Red
1
5
1
3
2
Blue
2
3
2
1
I have created new columns for each attribute but the result looks like this:
Ids
Color
Size
Pieces
1
Red
-
-
1
-
5
-
1
-
-
3
2
Blue
-
-
2
-
3
-
2
-
-
1
I need to transform this table in the following format:
Ids
Color
Size
Pieces
1
Red
5
3
2
Blue
3
1
I am not sure if a self-join on the attributes column and based on the Product IDs is the right solution here. If yes does anyone know how to do it?
If not then is there a better solution?
Thanks for the feedback!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.