我有 3 个表,想写选择结果,但我不知道如何使用 'join' 'inner' 'outer' 等,如果有人帮助我,将不胜感激。
表格:制造商/产品/产品描述
$manufacturer_query = "SELECT manufacturers_id from manufacturers WHERE manufacturers_name='" . $m ."'";
$manufacturer = mysql_query($manufacturer_query);
$mresult = mysql_fetch_array($manufacturer);
$products_query = "SELECT p.products_id, pd.products_description FROM products p, products_description pd WHERE p.products_id=pd.products_id AND p.manufacturers_id=" . $mresult['manufacturers_id'];
$products = mysql_query($products_query);
$presult = mysql_fetch_array($products);
$c = 0;
while ($presult){
$c++;
echo $c . ' - ' . $prod['p.products_id'] . ' - '.$prod['pd.products_description'].' - ' . $mresult['manufacturers_id'] . '<br>';
}