I have tables Product and productDetails. In productDetails I have rows with description of product in many languages (discriminated by lang column). Not every product will have description in every language. How to make a selection that will select the description in the specified language (by Where productDescription.lang = 'en'
) and that will select a description in a default language if the specified language is not present (descriptions with default language are always present).
I made this:
select *
from product
left join productDetails on product.id = productDetails.product_id
where productDetails.language = 'en';
and I get all details in en language. How to modify this to make details in default language selected if en is not present?