Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I can't group by!!!
Message
From
07/07/2009 08:30:56
 
 
To
06/07/2009 19:35:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01409847
Message ID:
01410512
Views:
61
>Thank you, Chuck and Sergey.
>
>i really couldn't understand why Microsoft changed the "group by" syntax and I don't understand how I can do to fix my instruction but your explanation was good for me.
>

The reason for the change was that the old way allowed bad results. Here's an example, using the Northwind data, that demonstrates the problem. To run this in VFP 8 or 9, you'll have to SET ENGINEBEHAVIOR 70:
SELECT Customers.CustomerID, CompanyName, ;
       MIN(OrderDate), ShippedDate ;
   FROM Customers ;
     JOIN Orders ;
       ON Customers.CustomerID = Orders.CustomerID ;
   WHERE BETWEEN(OrderDate, {^ 1996-9-1}, {^ 1996-9-30}) ;
   GROUP BY Customers.CustomerID ;
   INTO CURSOR FirstOrder
The problem here is that the ShippedDate you get in the result doesn't necessarily come from the order with the minimum order date. (In fact, because of the way VFP's engine works, you get the ShippedDate from the last order in the group.)

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform