0

I have 3 tables:

attribute:

attribute_id | name         | type
--------------------------------------
8            | material     | dict
9            | description  | text
10           | size         | numeric

dictionary:

dict_id | attribute_id | value
---------------------------------
101     | 8            | fabric
102     | 8            | metal
100     | 18           | example

product_values:

product_id | attribute_id | value
----------------------------------
2237       | 8            | 101,102
2237       | 9            | Lorem ipsum
2237       | 10           | 100

And I want output like this:

product_id | attribute_id | type    | value
---------------------------------------------
2237       | 8            | dict    | fabric
2237       | 8            | dict    | material
2237       | 9            | text    | Lorem ipsum
2237       | 10           | numeric | 100

If this is hard to achive I can modify this structure and migrate data but this is final solution. Thanks in advance.

0 Answers0