Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by clause
Message
From
27/02/2012 08:53:20
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01536615
Message ID:
01536621
Views:
40
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform