SQL Query Question ROW_CONCAT
        Posted  
        
            by DaveC
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by DaveC
        
        
        
        Published on 2010-05-20T18:28:22Z
        Indexed on 
            2010/05/20
            18:30 UTC
        
        
        Read the original article
        Hit count: 267
        
sql
Hello Guy,
I have been stuck on this problem for quite awhile... I hope someone out there can give me a hand.
The following table is in my database:
Product_ID Color   Type
1          Red     Leather
1          Silver  Metal
1          Blue    Leather
2          Orange  Metal
2          Purple  Metal
I am trying to get the following output:
Product_ID Type    Color
1          Leather Red, Blue
1          Metal   Silver
2          Metal   Orange, Purple
I know it has to do with some kind of double group by and a group_concat.... have been looking at this for an hour without figuring it out. Any help is much appreciated!!!
© Stack Overflow or respective owner