2011-07-25 79 views
0

我有以下查詢:調整SQL查詢

SELECT product_description.name, product.quantity,product.price 
    FROM product 
    INNER JOIN product_description 
    ON product.product_id=product_description.product_id 
    ORDER BY product_description.name 

我需要把幾個表,我曾嘗試以下,但我不確定我怎麼會延長我的超越一對。

錯誤:(在線)

SELECT product_description.name, product.quantity,product.price,product_option_value_description.name 
FROM product 
INNER JOIN product_description, product_option_value_description 
ON product.product_id=product_description.product_id=product_option_value_description.product_id 
ORDER BY product_description.name 

回答

4

你必須使用你想加入的每個表單獨的連接上

... 
JOIN Table1 ON ... 
JOIN Table2 ON ... 
... 
+0

權,一爲你! – Marco

2
SELECT pd.name,p.quantity,p.price,povd.name 
FROM product p 
INNER JOIN product_description pd ON p.product_id=pd.product_id 
INNER JOIN product_option_value_description povd ON p.product_id=povd.product_id 
ORDER BY pd.name