Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Yet another 'Group By' question re SET EngineBehavior
Message
De
13/08/2005 16:22:22
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Divers
Thread ID:
01040687
Message ID:
01040723
Vues:
17
Sergey --

Well, that certainly looks like what I want! And, as a nice bonus, it introduces me to some SQL syntax I was unaware of!

Thanks again (for what seems like the thousandth time ...)

Jim


>Jim,
>
>Try
SELECT Orders.*, tot.TOTAMT ;
>  FROM Orders ;
>    JOIN (SELECT OrdNbr, SUM(AMT) AS TOTAMT FROM Orders GROUP BY OrdNbr) tot ;
>  ON tot.OrdNbr = Orders.OrdNbr
>
>
>>In moving from SET EngineBehavior 70 to SET EngineBehavior 90 , I've encountered the same difficulties mentioned numerous times in this forum regarding the special attention necessary for the GROUP BY clause. I now understand the changes that are necessary when the old code fails, and have been happily making them as necessary.
>>
>>However, I do have some instances where the old behavior worked very nicely, and I don't see an easy solution using the new behavior:
>>
SELECT *, SUM(AMT) AS TOTAMT FROM Orders GROUP BY OrdNbr
>>The table "Orders", unfortunately, contains both parent records and child records. This particular selection would give me one record for each OrdNbr and all of the original fields from "Orders", so that I would, in effect, be creating the parent records (with the fields for what should have been child records containing irrelevant information.)
>>
>>So, is it possible to achieve the same effect using the new behavior without enumerating all the fields in the GROUP BY clause? (I can do it by enumerating the fields, but I certainly would hope not to have to do so).
>>
Jim Nelson
Newbury Park, CA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform