Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I can't group by!!!
Message
De
07/07/2009 08:30:56
 
 
À
06/07/2009 19:35:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01409847
Message ID:
01410512
Vues:
60
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform