>All fields, that are not listed in GROUP BY clause, must be in any aggregate function.
>
>So, your query will be
>
>
>> SELECT SUBSTR(f850nfac,2,4) as cpues, f850grav as cgrav, f850ivai as civai, f850exen as cexen, SUM(f850tota) as ctota, .t. as celijo ;
>> FROM &ivaventa WHERE LEFT(DTOS(f850ffac),6)==thisform.peri GROUP BY 1,2,3, NOCONSOLE INTO CURSOR cpuesto
>
Hi Naomi:
That's it. Actually I wanted to sum 2 throught 5 fields but as I failed so many times in the past I concentrate on "GROUP BY" and I haven't include SUM at first. Anyway I didn't know you have to include every field that doesn't have an "aggregate function". Today I've learned something new.
Thank you and Tamar very much.
Héctor