Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I sum without duplicates
Message
De
17/09/2004 10:50:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
17/09/2004 10:44:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00943380
Message ID:
00943383
Vues:
16
select JobNumber, Quantity group by JobNumber;
  into cursor Temp1;
  nofilter
select sum(Quantity) as Quantity;
  from Temp1;
  into cursor Temp2
Because of an irregularity (in the code above) in the use of GROUP BY, you may have to change SET ENGINEBEHAVIOUR in newer versions of VFP.

>I have some values I'd like to sum up, but I want to skip any duplicate entries from the sum
>
>For instance a table with 2 fields, Jobnumber & quantity. Would have data like this:
>
>Jobnumber Quantity
>1 10
>1 10
>2 25
>2 25
>3 1
>4 2
>4 2
>4 2
>
>How can I sum the quantity field and come up with a total of 38.
>
>this is on a report so I cant do a no duplicates in the table.
>
>It would be really nice if I could "Calculate sum(qty) for jobnumer is unique"
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform