I have the following problem. A table tb_cs of which I give a theoretical example:
id idcontrato idproducto cant
1 C1 IDP1 2
2 C1 IDP2 3
3 C1 IDP1 2
4 C1 IDP3 1
The problem is counting the amount sum of an IDP but I have to sort it by ID.
this is my query:
select idproducto idp, sum(cant) cidp
from tb_cs where idcontrato=:idc
group by idproducto
order by id
with that query I get an error for the activation of only_full_group_by, but if I include ID in the select ex:
select id, idproducto idp, sum(cant) cidp from tb_cs
where idcontrato=:idc
group by idproducto, id
order by id
I repeat the same IDP and that can not be.
I appreciate any help. I've already googled quantity and made any number of changes.