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. However, if order # 1111 has 3 items in the cart, it will include in that table the updated freight values. See:
IwouldliketoaddthevaluesofFreight,butbecarefulnottoadd02timesthefreightofthesameorder,whichinthiscaseis16.10.Itriedthisquery,butitdidnotwork:
SELECTSUM(ValorFrete)ASValorTFreteFROMloja_carrinhoWHEREStatusCompras='aguardando'GROUPBYValorFrete
Itreturnsonlyafirstvalueanddoesnotaddvalues.
WhengroupedbyOrder,itreturnsasfollows: