开发者

Adjusting SQL Query

I have the following query:

  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 

I need to incorporate a few more tables, I have tried the following but I am u开发者_运维问答nsure how I will extend my ON beyond one pair.

Error: (ON line)

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


You must use a separate join for each table you want to join on

...
JOIN Table1 ON ...
JOIN Table2 ON ...
...


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜