Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Summing values in a Grid Column
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00975355
Message ID:
00975388
Vues:
11
This is what I have done in the past:

This gets the detail:
SELECT 1 as tp,rdate,indamount FROM  reserve WHERE claim_id between 49142 AND 49162
This gets the total:
SELECT 9 as tp,{} as rdate,SUM(indamount) FROM  reserve WHERE claim_id between 49142 AND 49162
now union this and orde by tp first which will put the total to the bottom:
SELECT 1 as tp,rdate,indamount FROM  reserve WHERE claim_id between 49142 AND 49162;
union;
SELECT 9 as tp,{} as rdate,SUM(indamount) FROM  reserve WHERE claim_id between 49142 AND 49162
should give something like (partial list <g> :
Tp   Rdate   Indamount       
1    03/19/04        12300.00
1    03/31/04       -19990.00
1    03/31/04        17991.00
1    05/06/04       -46000.00
1    05/07/04           -1.00
1    06/10/04            0.00
1    06/23/04       -19841.00
1    06/23/04            0.00
1    07/02/04        -3500.00
1    07/28/04        -5000.00
9      /  /         164432.00  <----total 
if you have a character field you can set int to say 'Total'....



Hope this helpd. The total is always lined up with the detail. If you play with it you can have tp=2 for a sub total etc....


Peter


>Hi,
>
>I've got a grid with a list of payments received from a customer. I'd like to display a total of all payments for the current customer into a readonly textbox.
>
>Is there an easy way of doing this?
>
>Thanks,
>
>Dennis
Peter Cortiel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform