Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT COUNT(*)

Status
Not open for further replies.

INFORMAT

Programmer
Jan 3, 2001
121
BE
Hi,

Can you do something like
SELECT COUNT(*) FROM curEmployees

in VFP?

curEmployees is a simple VFP cursor
 

Yes, is there a problem when you tried it?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Informat,

Can you do something like
SELECT COUNT(*) FROM curEmployees


You can do exactly that. The result will appear in a new cursor or browse window, with one row and one column.

But a much easier way would be:
? RECCOUNT("curEmployees")

(assuming curEmployees has no deleted records and there is no filter in force).

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Mike said:
assuming curEmployees has no deleted records and there is no filter in force
For further clarification, ? RECCOUNT("curEmployees") will return the same total irrespective of a filter being in force, and will be the total of all records including those marked as deleted.


FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommander[sup]tm[/sup].com
PDFcommander[sup]tm[/sup].co.uk


 
Chris,

, ? RECCOUNT("curEmployees") will return the same total irrespective of a filter being in force, and will be the total of all records including those marked as deleted.


Yes, I agree. My point was that that might not match the number of records Informat was expecting to see. Presumably, if records were deleted or filtered out, he would expect those to be excluded from the count. (Or maybe not.)

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Mike
Mike said:
My point was that that might not match the number of records Informat was expecting to see.

That was the point I was also trying to make by the further explanation of your comments - should there be deleted records or a filter in force then RECC() would only be a solution for the total number of records. [smile]
Mike said:
Presumably, if records were deleted or filtered out, he would expect those to be excluded from the count. (Or maybe not.)
Good question - perhaps Informat could advise whether he or she is seeking available records or total records?


FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommander[sup]tm[/sup].com
PDFcommander[sup]tm[/sup].co.uk


 
I am seeking for available records

Thanks for the answers!
 
You can use:

SELECT COUNT(*) FROM cursorname INTO ARRAY laCnt

You'll get the number of active, (not deleted), records in the array.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top