Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can _tally be used when using SUM or COUNT?
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01147656
Message ID:
01147665
Views:
20
>>>I have noticed that when I run a SQL Select that is based on SUM() and COUNT() functions (to group certain records), the _TALLY returns a value greater than 0, even if no records match the WHERE clause. Is this by design? Or am I missing something?
>>
>>If you Select into a cursor, VFP will create a cursor with one record to hold the result, and _tally reports 1 which is the same as the number of records in this cursor.
>
>Therefore, I see that _tally in unreliable method of checking if SQL select found any "valid" records. What do you suggest to use then?
>

The COUNT() will return 0 if there's no GROUP BY and _TALLY will be 0 if there's GROUP BY and no records match WHERE clause..
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform