Jump to content

NO GROUP_CONCAT


nnvlahovic
 Share

Recommended Posts

Hello everyone.

 

Iam stuck with this. Plz help.

 

SELECT p.id_product, p.active, pl.name, GROUP_CONCAT( DISTINCT (

cl.name

)

SEPARATOR  "," ) AS categories, p.price, p.id_tax_rules_group, p.wholesale_price, p.reference, p.supplier_reference, p.id_supplier, p.id_manufacturer, p.upc, p.ecotax, p.weight, p.quantity, pl.description_short, pl.description, pl.meta_title, pl.meta_keywords, pl.meta_description, pl.link_rewrite, pl.available_now, pl.available_later, p.available_for_order, p.date_add, p.show_price, p.online_only, p.condition, p.id_shop_default, p.width, p.height, 

GROUP_CONCAT(DISTINCT (CONCAT(fl.name," : ",flv.value)) SEPARATOR ", " ) AS features

FROM ps_product p

LEFT JOIN ps_product_lang pl ON ( p.id_product = pl.id_product ) 

LEFT JOIN ps_category_product cp ON ( p.id_product = cp.id_product ) 

LEFT JOIN ps_category_lang cl ON ( cp.id_category = cl.id_category ) 

LEFT JOIN ps_category c ON ( cp.id_category = c.id_category ) 

LEFT JOIN ps_product_tag pt ON ( p.id_product = pt.id_product )

LEFT JOIN ps_feature_product fp ON (p.id_product = fp.id_product)

LEFT JOIN ps_feature_lang fl ON (fp.id_feature = fl.id_feature AND fl.id_lang = pl.id_lang)

LEFT JOIN ps_feature_value_lang flv ON (fp.id_feature_value = flv.id_feature_value AND flv.id_lang = pl.id_lang)

WHERE pl.id_lang =1

AND cl.id_lang =1

AND p.id_shop_default =1

AND c.id_shop_default =1

GROUP BY p.id_product

LIMIT 0 , 30

 

 

I need NO "GROUP_CONCAT(DISTINCT (CONCAT(fl.name," : ",flv.value)) SEPARATOR ", " ) AS features".

 

Now it is like:

 

|Features|

|name:text, country:text, pile:text, size:.....|

All in one field.

I woould appreciate if somebody can help me, to make each value from the table field features into each separate in one field.

it has to be:

|Name|Country|Pile|Size|

|xxxx|xxxxxxx|xxxx|xxxx|

It should be like this.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More