>>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)