I want to convert the following query into a view, but I still get the error mentioned above. This is my query:
SELECT C.id_pdmatriz, C.id_proveedor, C.Precio , x.Nombre , p.Nombre
FROM (
SELECT MIN(A.Precio) AS Precio , A.id_pdmatriz
FROM producto A where A.id_proveedor > 0 and A.Estado_id !=5
GROUP BY A.id_pdmatriz) B
JOIN producto C
ON B.Precio = C.Precio
and B.id_pdmatriz = C.id_pdmatriz
left Join producto_matriz x
ON C.id_pdmatriz = x.id
left Join proveedor p
ON C.id_proveedor = p.id;
Can you help me create a view with this query? Why do I get the error?