Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL-Select that sums
Message
De
06/02/2003 18:28:22
 
 
À
06/02/2003 18:11:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00750295
Message ID:
00750315
Vues:
21
Winn,

As soon as you group the records, some of the fields are not relevant any more. In your example, you may want the following, assuming that there is a one-to-one relationship between lotName and line:
SELECT lotName, line, SUM(lbs) AS sum_lbs FROM myTable GROUP BY line into cursor cursor1
This will return 3 records from your example table. If you include item and lbs fields, it will only have the value of one of the records in the group...so they are meaningless.

>>Something like this?
>>
>>
>>SELECT line, SUM(lbs) AS sum_lbs FROM myTable GROUP BY line
>>
>
>Yeah, that's the idea, but with all fields, not just those two.
>Or do I have to put in every field name in that case?
Steve Gibson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform