Well I need help with my sql code. This is my code:
SELECT Pedidos.Numero, Pedidos.Estado, Pedidositems.Cantidad AS CantidadPedida, RemitosItems.Cantidad AS CantidadEntregada, pedidositems.Codigo AS CodigodeProducto, pedidositems.Descripción AS DescripcionProducto
FROM (((((Empresas
LEFT JOIN 'productos' ON ('productos'.'recid'='pedidositems'.'idproducto'))
INNER JOIN 'pedidositems' ON ('pedidositems'.'idpedido'='pedidos'.'recid'))
INNER JOIN 'pedidos' ON ('pedidos'.'idref'='contactos'.'idcontacto') AND pedidos.estado = 0)
LEFT JOIN remitositems ON ('remitositems'.'idpedprod'='pedidositems'.'recid'))
LEFT JOIN remitos ON (remitos.RecID=remitositems.IDRemito) AND remitos.estado =1)
This is the result for one of the many companies
Basically what I would need, is that all those products that are already delivered completely disappear. That I keep the products as the second item, or also partially delivered products if they were in the order. I thought to put some kind of relationship between the Quantities of the orders and the Remitos, if they are different or something of that, but when I tried it I filtered the data badly.
Well that was my problem, I hope someone can help me. Thank you very much