我从一个表中选择数据,但我还需要使用另一个表的选择条款:
sql& PHP:
$condition = "
AND CONCAT_WS('- ', products_description.products_id, products_attributes.products_attributes_id) = '".$product_number."'
OR products_description.products_id = '".$product_number."'";
$show_products_query_string = "
SELECT
products_description.products_id AS id,
products_description.products_name AS product_name,
products.products_image AS product_image
FROM
products_description
LEFT JOIN products ON products_description.products_id = products.products_id
LEFT JOIN warehouse_products ON products_description.products_id = warehouse_products.id" . $filter.$condition;
在这个查询中,我只需要显示我选择的内容:id,name,image_name。
提前谢谢!