I have 3 tables.
product
-----------------------------------------------
product_code | product_header
-----------------------------------------------
12345 | Wilson Pro-staff Grip plus Glove
product_attribute
---------------------------
product_code | attribute_id
---------------------------
12345 | 1
12345 | 2
product_attribute_types
-----------------------------
attribute_id | attribute_name
-----------------------------
1 | Size
2 | Colour
This is the output that I would like to have:
--------------------------------------------------------------------
product_code | product_header | attributes
--------------------------------------------------------------------
12345 | Wilson Pro-staff Grip plus Glove | Size, Colour
How can I do this on PostgreSQL or MS SQL?