Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group By Example in VFP 8
Message
From
21/07/2004 18:23:46
 
 
To
21/07/2004 18:19:25
Luis Navas
Independent Consultant
Auckland, New Zealand
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00926827
Message ID:
00926829
Views:
11
The GROUP BY must include all the fields in the SELECT that are not aggregate fields (SUM, AVG, etc).
GROUP BY Codpai, Codven, Valpedmn, Fecped, Nompai, Nomven
>Hi to all, can anyone give an example of how to perform this SELECT in VFP 8: I nknow i can make this work using Set EngineBehavior, but I want to use the correct way in VFP 8.
>Luis Navas
>
>
>Select Pedidos.Codpai, Pedidos.Codven, Pedidos.Valpedmn, Pedidos.Fecped, Maepai.nompai, Maeven.nomven, ;
>Iif(Month(fecped)=1,Sum(valpedmn),0) As enero, Iif(Month(fecped)=2,Sum(valpedmn),0) As Febrero, Iif(Month(fecped)=3,Sum(valpedmn),0) As Marzo, ;
>Iif(Month(fecped)=4,Sum(valpedmn),0) As Abril, Iif(Month(fecped)=5,Sum(valpedmn),0) As mayo, Iif(Month(fecped)=6,Sum(valpedmn),0) As junio,;
>Iif(Month(fecped)=7,Sum(valpedmn),0) As Julio, Iif(Month(fecped)=8,Sum(valpedmn),0) As Agosto,Iif(Month(fecped)=9,Sum(valpedmn),0) As septiembre,;
>Iif(Month(fecped)=10,Sum(valpedmn),0) As Octubre, Iif(Month(fecped)=11,Sum(valpedmn),0) As Noviembre, Iif(Month(fecped)=12,Sum(valpedmn),0) As diciembre ;
>From Pedidos ;
>Inner Join Maepai On Pedidos.Codpai=Maepai.Codpai Inner Join Maeven On Pedidos.codven=Maeven.codven ;
>Group By Pedidos.Codpai Where Pedidos.Fecped Between This.Cajafecha1.Value And This.Cajafecha2.Value Into Cursor (This.lcCursor) ReadWrite
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform