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 17:56:07
 
 
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:
01040737
Vues:
18
Does it? I mean, if there is a field Orders.Partno, and there are records for one OrdNbr that have different PartNos, won't those still come out as distinct records?

Jim

>If you don't have memo fileds in the table, following should work
>SELECT DIST * FROM (
>  SELECT Orders.*, tot.TOTAMT ;
>    FROM Orders ;
>      JOIN (SELECT OrdNbr, SUM(AMT) AS TOTAMT FROM Orders GROUP BY OrdNbr) tot ;
>    ON tot.OrdNbr = Orders.OrdNbr
>) dt1
>
>
>
>
>>
>>Unfortunately, I don't seem to be getting the results I expect. I still get one record for every original record I selected from "Orders", with the total column added at the end.
>>
>>What I'm looking for, and get with 70, is that I get one record for each unique OrdNbr in "Orders", with the total column added at the end. Thus, I get the same number or records as you obtained within your sub-query. It looks like the JOIN you suggested each of the records from my original table with the single row from the sub-query; I want one row (and I don't care which one) from the original table for each row in the sub-query.
>>
Jim Nelson
Newbury Park, CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform