Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Statement help
Message
De
10/06/2002 12:01:24
 
 
À
08/06/2002 08:22:47
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00666106
Message ID:
00666562
Vues:
20
>>Hi All,
>> I have need of a select statement that adds certain values and returns a single record out of, for example, two records.
>>
>>
 1   GLOC  20228       9.33247      1.10   92.16   1    T   P   1
>> 2   GLOC  17533       5.00000      1.10   92.16   1    T   P   2
>>
>>The select statement would preferably return
>>
>>
1   GLOC  20228       14.33247      1.10   92.16   1    T   P   1
>>
>>I guess what I am saying is that I want to add one value out of one record to the other value in the first. Does anyone have any ideas?
>>Thanks,
>
>Win if I understand you right you want to :
>1) Sum some fields
>2) Get first record of some key (GLOC here)
>
>Aggregate functions by nature always get the last entry for non-aggregate fields. Therefore first you should take the table upside down then sum :
>
>
select * from myTable ;
> order by GLOCField descending ;
> into cursor UpSideDown ;
> nofilter
>
>select *, sum(SumField) as TotSomething ;
> from UpSideDown ;
> group by GLOCField ;
> into cursor mySum
>
>PS: If the record you want to get with same key had something like being max() of that group then you could do that in one SQL.
>Cetin


Hilmar & Cetin,
Thanks for your replys. I think I am on the right track now.
Winn Pauley
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform