I have this complex query:
SELECT
c.ep_cor_nome, c2.ep_cor_nome ep_cor_nome_1, md.ep_madein_nome, o.ep_origem_nome, m.ep_material_nome material_base, m2.ep_material_nome material_pelo
FROM products p
LEFT JOIN
products_cor c ON p.ep_cor_id = c.ep_cor_id
LEFT JOIN
products_cor c2 ON p.ep_cor2_id = c2.ep_cor_id
LEFT JOIN
products_madein md ON p.ep_madein_id = md.ep_madein_id
LEFT JOIN
products_origem o ON p.ep_origem_id = o.ep_origem_id
LEFT JOIN
products_materiais m ON p.ep_materialbase_id = m.ep_material_id
LEFT JOIN
products_materiais m2 ON p.ep_materialbase_id = m2.ep_material_id
WHERE p.products_id = '1300' AND m.language_id = '4' AND m2.language_id = '4' AND md.language_id = '4'
What I've noticed is that if one of the LEFT JOIN fields is empty, the query returns nothing.
How do I process this query sucessfuly even if the PRODUCT has empty fields?
Maybe LEFT JOIN is misused here?