Problème de jointure entre 3 table
Bonjour à tous,
je dois extraire des informations qui sont dans trois table, concernant un produit.
J'ai l'id d'un produit 1.
Les informations que j'ai besoin sont:
Table ps_produit:
id_produit
show_price
on_sale
table ps_produit_lang:
id_product
id_lang
name
Table ps_specific_price
id_product
reduction
reduction_type
from
to
Toutes mes table on un point comment : id_product
J'ai donc fait la jointure de cette maniere
Code:
1 2 3 4 5 6 7 8
|
$product_info = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'product p
INNER JOIN '._DB_PREFIX_.'product_lang pl ON p.id_product = pl.id_product
INNER JOIN '._DB_PREFIX_.'specific_price sp ON p.id_product = sp.id_product
WHERE p.id_product = '.$id_product.' AND p.show_price = 1 AND pl.id_lang = '.(($cookie->id_lang) ? $cookie->id_lang : Configuration::get('PS_LANG_DEFAULT'))
);
echo $numRows = (int)(Db::getInstance()->numRows()); |
le problème que j'ai, c'est quand j'enlève ca:
Code:
INNER JOIN '._DB_PREFIX_.'specific_price sp ON p.id_product = sp.id_product
ca marche très bien
Mais quand je l'ajoute, $numRows me retourne 0
Je pense que ma troisème jointure n'est pas correcte.
Comment puis-je a corriger pour les informations des trois table?
es-ce que je vous ai fourni assez d'information?
merci