I need to do a left join
in MySql and it's not working. I have 4 tables: articulos
, subcategoria
, categoria
and ventas
. I want to show all the independent items that have sales or not.
Each article has a subcategory and a category respectively. And I try to show filtered sales by category. this is what I am trying:
SELECT
A.*,
B.FECHA,
B.TOTAL
FROM
ARTICULOS A,
SUBCATEGORIA C,
CATEGORIA D
LEFT JOIN
VENTAS B ON A.IDARTICULO = B.FK_IDARTICULO
WHERE
A.FK_IDSUBCATEGORIA = C.ID_SUBCATEGORIA
AND C.FK_IDCATEGORIA = D.ID_CATEGORIA
AND D.ID_CATEGORIA = 1
This only shows results for articles that have sales. How can I do it?? thanks