2
I’m trying to create a report using ReportViewer
that makes a SUM
in the same column for different criteria. My query works well in Phpmyadmin but in Querybuilder of Reportviewer does not work and returns an error.
How to solve this problem ?
here my query.
SELECT e.id, e.tipoOperacao, e.historico,
SUM(CASE WHEN e.tipoOperacao = 'E' THEN e.qtdTransacao ELSE 0 END) AS QTDENTRADA,
SUM(CASE WHEN e.tipoOperacao = 'S' THEN e.qtdTransacao ELSE 0 END) AS QTDSAIDA,
e.dtTransacao, e.valorTransacao, e.usuario, e.produto_id, p.id AS Expr1, p.descricao,
p.valorCusto, p.valorVenda, p.controlarEstoque, p.qtdEntEstoque, p.estoqueMin,
p.estoqueMax, p.status, p.imagem, p.catproduto_id, p.unidproduto_id
FROM estoque e
INNER JOIN produto p ON (e.produto_id = p.id)
WHERE e.dtTransacao BETWEEN @DI AND @DF GROUP BY e.produto_id
Here the error.
http://answall.com/a/127134/70
– Bacco