i have checked some similar issues in the forum but i can’t seems to get it to work properly.
i’m on phpmyadmin
i need to get a result like that :
Reference | ProductNameEnglish | ProductNameFrench
What’s blocking me is to do 2 requests on the same column (pl.name) :/
Here is my query for now :
SELECT
p.reference AS Reference,
(SELECT pl.name
FROM ps_product p
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
WHERE p.active = 1
AND pl.id_lang = 2) AS ENname,
(SELECT pl.name
FROM ps_product p
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
WHERE p.active = 1
AND pl.id_lang = 1) AS FRname
FROM ps_product p
2
Answers
You don’t need the join in the subqueries:
This assumes that only one row matches the subqueries. You may need to limit the results to a single row if that is not the case.
I might have switched English and French, but that should be easy to fix….