select sum(A.qtdxunit-A.desconto-A.desconto_item+A.acrescimo), B.aliquota from movdiario A inner join aliquotas B on A.aliquota = B.POSICAO where emissao between('2014-09-01') and ('2014-09-30') and tipo = 'V' and (situacao = '' or situacao = ' ' or situacao is null) group by A.aliquota; select sum(A.qtdxunit-A.desconto-A.desconto_item+A.acrescimo) * (B.aliquota/100), B.aliquota from movdiario A inner join aliquotas B on A.aliquota = B.POSICAO where emissao between('2014-09-01') and ('2014-09-30') and tipo = 'V' and (situacao = '' or situacao = ' ' or situacao is null) group by A.aliquota; select sum(A.qtdxunit-A.desconto-A.desconto_item+A.acrescimo) * (B.aliquota/100), B.aliquota, A.aliquotaicms from movdiario A inner join aliquotas B on A.aliquota = B.POSICAO where emissao between('2014-09-01') and ('2014-09-30') and tipo = 'V' and (situacao = '' or situacao = ' ' or situacao is null) group by A.aliquota; select sum(A.qtdxunit-A.desconto-A.desconto_item) * (B.aliquota/100) , B.aliquota, A.aliquotaicms from movdiario A inner join aliquotas B on A.aliquota = B.POSICAO where emissao between('2014-09-01') and ('2014-09-30') and tipo = 'V' and (situacao = '' or situacao = ' ' or situacao is null) group by A.aliquota; select sum(A.qtdxunit-A.desconto) * (B.aliquota/100) , B.aliquota, A.aliquotaicms from movdiario A inner join aliquotas B on A.aliquota = B.POSICAO where emissao between('2014-09-01') and ('2014-09-30') and tipo = 'V' and (situacao = '' or situacao = ' ' or situacao is null) group by A.aliquota; ************* Resumo select sum(A.valor * ((A.aliquota/100)/100)), A.aliquota from ANALITICO60 A where dtmovimento between ('2014-09-01') and ('2014-09-30') and id_empresa group by A.aliquota select sum(A.qtdxunit-A.desconto) * (B.aliquota/100) , B.aliquota, A.aliquotaicms from movdiario A inner join aliquotas B on A.aliquota = B.POSICAO where emissao between('2014-09-01') and ('2014-09-30') and tipo = 'V' and (situacao = '' or situacao = ' ' or situacao is null) group by A.aliquota