0

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?

3
Contributors
2
Replies
5
Views
5 Years
Discussion Span
Last Post by ddymacek
0

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;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.