2
I have a table where I store the freight values, but when the cart is updated with the freight value, this value is also updated in the table. But if order #1111 has 3 products in the cart, it will include in this table the updated shipping values. See:
I would like to add the values of the Freight, but with the care of not adding 02 times the freight of the same order, which in case is 16.10. I tried that query, but it didn’t work:
SELECT SUM(ValorFrete) AS ValorTFrete FROM loja_carrinho WHERE StatusCompras = 'aguardando' GROUP BY ValorFrete
It returns me only a first value and does not sum the values.
When grouping by Request, returns this way:
Do you want the overall sum of all orders? but, do not repeat by numpedido?
– novic
That. I want to add the value of the freight, but not repeating if it is the same Numpedido, ie, in the first image, I would add 16.10 + 17.20 and not 16.10 + 16.10 + 17.20
– user24136
Test the SQL I’ve changed now
– novic