Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding [sum]med data to an exisiting column(field)
Message
 
À
04/11/2002 12:57:55
Billy Bramhall
Interdirect Usa, Inc.
Houston, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00718585
Message ID:
00718594
Vues:
13
Something like:

create table hi (recid c(10), amount n(8))
insert into hi (amount) values (12)
insert into hi (amount) values (10)
insert into hi (amount) values (6)
insert into hi (amount) values (2)

insert into hi (amount) values (22)
insert into hi (amount) values (20)
insert into hi (amount) values (26)
insert into hi (amount) values (22)

replace all recid with padl(alltr(str(recn())),10,"0")

go top
do while not eof()
lnlastid=val(recid)+4
calc sum(amount) to ln while val(recid) '<' lnlastid

insert BEFORE blank
repl amount with ln

skip 1
enddo


>I have a table with numeric values. I would like to sum all the values in one particular column and put the summed value as the next available recno.
>Below is an example of what I'm looking to do:
>
>
>(I.E: I want to sum recno 1 - 4, and put the sum value in recno 5, - summed value would be "30")
>
>(column) Customers
>(recno=1) 12
>(recno=2) 10
>(recno=3) 06
>(recno=4) 02
>(recno=5)
>
>I would like to have syntax that I can use in the command window if at all possible.
>
>Any help would be appreciated.
>
>Thank you,
>Billy
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform