Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT * and SELECT COUNT(*) - different results
Message
 
 
To
11/05/1998 10:34:37
Andrzej Majlich
Vulcan sp. z o. o.
Wroclaw, Poland
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00098482
Message ID:
00098522
Views:
23
Andrzej,

There was just another thread on this topic. To find the number of records in a SQL-SELECT cursor you use _tally. RECCOUNT() is for physical tables not cursors. Rushmore may implement a cursor as a SET FILTER if that's the fastest way to do it.

>I've found (maybe it's surprise only for me?) that when you issue the commands - you typically get different results. The first returns cursor containing a set of records (depending on your SET DELETED it's all records or only not deleted ones).
>The second command returns (I would say 'always' - but can't) number of all records ignoring SET DELETED setting.
>
>There is one exception: When you have index tag on DELETED(). In the case SELECT COUNT(*) returns the number of not deleted records.
>
>I'm wondering if it's caused by a bug in rushmore optimization or I don't understand something?
>
>CREATE TABLE newtable FREE (fld1 C(10))
>APPEND BLANK
>APPEND BLANK
>DELETE
>*Without index on deleted results differ
>SET DELETED ON
>SELECT * FROM newtable
>?RECCOUNT('newtable')
>SELECT COUNT(*) FROM newtable
>?query.cnt
>*Exception?
>SELECT newtable
>INDEX ON DELETED() TAG dltd
>SELECT * FROM newtable
>?RECCOUNT('newtable')
>SELECT COUNT(*) FROM newtable
>?query.cnt
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform