Member Avatar for deleted1234

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?

Does it have to be those DB types? Or is mySQL good for you?

you can try something along the lines of the following:

select * from (product left join product_attribute on product.product_code = product_attribute.productcode) left join product_attribute_types on product_attribute.attribute_id = product_attriubute_types.attribute_id;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.