MySQL Forums
Forum List  »  Newbie

GROUP_CONCAT question
Posted by: Steve Delaney
Date: March 17, 2010 09:25AM

I am trying to extract/transpose some data, and from other posts I think GROUP_CONCAT may be the answer, but perhaps a little too complicated yet for me!

I have this information in a table:

Order | Product | Option | Value |
1 | 10 | Colour | Red |
1 | 10 | Size | Large |
1 | 10 | Sleeve | Short |
2 | 10 | Colour | Blue |
2 | 10 | Size | Small |
2 | 10 | Sleeve | Long |

and want it to be extracted like this:

Order | Product | Colour | Size | Sleeve |
1 | 10 | Red | Large | Short |
2 | 10 | Blue | Small | Long |

I've managed to get all the Values crammed into one column, with the values separated by a symbol (like this: | 1 | 10 | Red, Large, Short | ), but it would be much better to have them in separate columns.

Can someone help me with this?

Steve

Options: ReplyQuote


Subject
Written By
Posted
GROUP_CONCAT question
March 17, 2010 09:25AM
March 17, 2010 09:31AM
March 17, 2010 10:08AM
March 17, 2010 10:49AM
March 17, 2010 07:51PM
March 18, 2010 01:05PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.