Skip to content

Instantly share code, notes, and snippets.

View stratboy's full-sized avatar

Luca Reghellin stratboy

View GitHub Profile
@stratboy
stratboy / extract-products-from-prestashop.sql
Last active February 29, 2024 20:14
A query to extract products and their features from prestashop, with features in columns
select
subquery.id_product,
subquery.reference,
subquery.product_name,
Max(CASE WHEN subquery.feature_name = 'Feature 1' THEN subquery.feature_value END) AS `Feature 1`,
Max(CASE WHEN subquery.feature_name = 'Feature 2' THEN subquery.feature_value END) AS `Feature 2`,
Max(CASE WHEN subquery.feature_name = 'Feature 3' THEN subquery.feature_value END) AS `Feature 3`
from (
select
fp.id_product as id_product,