Reputation:
SELECT p.product_id, p.quantity, p.price, pd.name, pd.description
FROM product AS p
INNER JOIN product_description AS pd ON p.product_id = pd.product_id
WHERE p.product_id = 1 AND pd.landuage_id = 5
In this query, only one condition exists, p.product_id
in this case, but the other condition pd.landuage_id
does not exist. I want the request to be executed, whether it exists. How to do it ?
Upvotes: 0
Views: 46
Reputation: 3733
It's possible duplicate, but right answer is:
SELECT p.product_id, p.quantity, p.price, pd.name, pd.description
FROM product p
LEFT JOIN product_description pd ON p.product_id = pd.product_id AND pd.language_id = 5
WHERE p.product_id = 1;
Upvotes: 1