1
I could use a little help with a consult. I have a sales chart where has the field vltotal and vldevolucao, the total of these fields already managed, but I’m not getting the result of the sum of them. My script is:
select distinct codusur, sum(vltotal) as valor, sum(vldevolucao) as
Devolucao, count(codcli), sum(vltotal - vldevolucao) as liquido
from pcnfsaid
where dtsaida between trunc(sysdate, 'month') and sysdate
and vlbonific = 0
and codsupervisor = 2
group by codusur
order by codusur
I have that result:
I don’t know if I understand, but try "rollup" or "Cube" https://oracle-base.com/articles/misc/rollup-cube-grouping-functions-and-grouping-sets
– Motta
I need the LIQUID to be VALUE - DEVOLUCAO. See in this example: codusur 4 - 13990,36 - 419,19 the correct would be LIQUIDO 13574,17 codusu 7 - 18832,30 - 953,80 the correct would be LIQUIDO 17878,50
– Fabio Fleck
Try taking out the "distinct"
– Motta