Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Count command
Message
De
08/05/2003 14:01:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00785705
Message ID:
00786381
Vues:
17
>>Hi Guys,
>>
>>I am trying to count the number of distinct records in a field.
>>
>>If I try the following:
>>
>>select count(DISTINCT P_no) from DATATMP
>>
>>This gives me a query Dcnt_p_no with the correct result.
>>
>>I dont want to be presented with the results of the query and
>>just want to store this count to a variable.
>>
>>Is there any easier way of doing this?
>
>You can store the count to an array:
>
> select count(DISTINCT P_no) from DATATMP ;
> INTO ARRAY aResults
>
>Then look at aResults[1].
>- I don't know why Microsoft does not add the ability to send the result
> to a variable!

An array IS a variable. What would happen if your code returned more than one row? (I know COUNT only returns one row)
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform