Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How Do You All Handle Group By Command
Message
De
02/08/2006 13:04:42
 
 
À
02/08/2006 11:55:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01141909
Message ID:
01142485
Vues:
7
>>Actually, I think this situation comes up most when you want to select several fields from a parent along with some information from a child. For example:
>>
>>
>>SELECT Customer.CustomerID, CompanyName, MAX(OrderDate) ;
>>  FROM Customer ;
>>    JOIN Order ;
>>      ON Customer.CustomerID = Order.CustomerID ;
>>  GROUP BY CustomerID
>>
>>
>>In this case, of course, either solution--adding the field to the GROUP BY or wrapping it with MAX()--works.
>>
>>Tamar
>
>mmmm...
>
>I don't agree, this SQL syntax is wrong for me.
>
>The exact declaration of the request in SQL syntax should to be:
>
>SELECT Customer.CustomerID, CompanyName, MAX_OrderDate ;
>    FROM Customer ;
>    JOIN (SELECT CustomerID,MAX(OrderDate) MAX_OrderDate FROM Order GROUP BY CustomerID) Order;
>    ON Customer.CustomerID = Order.CustomerID
>
>
>Of course, every SQL engine can or cannot to be able of to execute the declaration
>with a fast or slow plan, but this is out of the SQL syntax scope.
>

I agree that the derived table is a better choice, but in VFP, we couldn't do that until VFP 9.

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform