Si la tabla product
contiene al menos un dato. Y desea mostrar otras columnas, ya sea NULL
o cadena personalizada como "---"
debe especificar en la consulta que se une incluso si el atributo de unión es nulo. Entonces, la siguiente consulta le dará datos.
SELECT
p.description AS p_description ,ifnull(pd.description,"---") AS pd_description,
ifnull(psd.description,"--") AS psd_description
FROM product AS p
LEFT JOIN Product_description AS pd ON(pd.product_id = p.product_id)
LEFT JOIN product_store_description AS psd ON(psd.product_id = p.product_id)
WHERE p.product_id = '1' AND (pd.language = 'en' or pd.language is null)
AND (psd.language = 'en' or psd.language is null) AND
(psd.store_id = 1 or psd.store_id is null);