Why can’t I group data into that query?

Asked

Viewed 48 times

-1

SELECT e.idproduto codigo,
       p.descricaoproduto nome,
       sum(e.qtde) entrada,
       sum(s.qtde) saida
FROM itementrada e
INNER JOIN produto p ON e.idproduto = p.idproduto
INNER JOIN itemsaida s ON p.idproduto = s.idproduto
GROUP BY e.idproduto

can't format message 13:896 -- message file C:\WINDOWS\firebird.msg not found.
Dynamic SQL Error.
SQL error code = -104.
Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause)
  • 2

    GROUP BY e.idproduto,p.descricaoproduct , I believe

  • That’s exactly what it was. Thank you!

1 answer

1

The field descricaoproduto does not allow grouping to occur. Or enter it in group by, or remove the field from your select.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.