Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can _tally be used when using SUM or COUNT?
Message
From
22/08/2006 15:06:28
 
 
To
22/08/2006 14:57:00
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:
01147673
Views:
20
Thanks Tore,

I would never have thought of using an aggregate function without a GROUP BY clause so I guess my code will be safe.

>>Hi Tore,
>>
>>I've never heard of this before and have been relying on this for many years now. I have just done some testing and _TALLY appears to always return 0 if no records were selected, even if selecting into a cursor.
>>
>>Can you give me a scenario where _tally will get set to 1 when no records are selected?
>
>SELECT COUNT(1) FROM yourtable WHERE .f.
>
>>>>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.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform