I have two tables BMV_PEDIDO
and BMV_PEDIDOITEM
and would like the total sum of the value of the orders made on a certain date. Currently I do this by request, that is, I replicate this code 70x.
I would like my query to return all of them.
Following is the current script :
SELECT p.ST_FRETE, SUM(i.NR_QTDE * i.VL_UNITARIO * i.NR_TAXACONVERSAO)
FROM BMV_PEDIDOITEM i
INNER JOIN BMV_PEDIDO p ON p.ID_PEDIDO = i.ID_PEDIDO
WHERE p.ID_PEDIDO IN (45752)
GROUP BY p.ST_FRETE