Help with GROUP_CONCAT
Hi,
Currently I have the following code:
select Product_ID, group_concat(`Name` separator ',') as `Spec`
from
(
select Product_ID, concat(`Name`, ':',
group_concat(`Value` separator ',')) as `Name`
from product_spec_list
group by Product_ID, `Name`
) tbl
group by Product_ID
Which produces:
3 Shielded:0,Type:General Purpose
4 Shielded:0,Type:General Purpose
etc. with a long list of Names and Values separated by : and ,.
How do I separate the Values into Columns named by 'Name'?
E.g.
ID Shielded Type
3 0 General Purpose
4 0 General Purpose
Thanks for any help
Subject
Written By
Posted
Help with GROUP_CONCAT
September 30, 2014 06:18AM
September 30, 2014 10:22AM
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.