Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count command
Message
From
08/05/2003 14:01:35
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00785705
Message ID:
00786381
Views:
18
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform