すでに機能しているクエリに別のテーブルを追加しようとしていますが、何らかの理由でエラーが発生しています。別の関数によって実行されているため、クエリを続行するのに十分かどうかはわかりませんが、それは私のクエリかもしれません..
動作する元のクエリは次のとおりです。
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_model,
p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status,
s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price) as final_price
from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p
left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id
left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id,
" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_status = '1' and p.products_id = p2c.products_id and
pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and
p2c.categories_id = '" . (int)$current_category_id . "'";
そして、追加されたテーブルと where 句 (TABLE_PRODUCTS_ATTRIBUTES
は新しいテーブル pa)を使用した新しいクエリを次に示します。
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_model,
p.manufacturers_id, p.products_price, pa.products_values_id, p.products_tax_class_id,
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,
IF(s.status, s.specials_new_products_price, p.products_price) as final_price
from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_ATTRIBUTES . " pa
left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id
left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id,
" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_status = '1' and p.products_id = p2c.products_id and p.products_id =
pa.products_id and pd.products_id = p2c.products_id and pd.language_id = '" .
(int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
すぐにクエリに何か問題がありますか?