Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL SELECT (*) with COUNT(*)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00387199
Message ID:
00387255
Views:
20
>>>Is there a way to run an SQL SELECT and get ALL the rows of data and still get a COUNT(*)? I have tried this, but it looks like like I'm just getting the last row of data along with the count. TIA, Chuck.
>>
>>The problem you're having is that COUNT is an aggregate function, meaning it will group records into a single record in the result based on what's in your GROUP BY expression. If you don't specify a GROUP BY, then everything gets grouped into a single record.
>>
>>What you want to do is just SELECT * and look at _TALLY for the count.
>
>Barbara,
>
>I haven't worked with _TALLY before. Can you give me a quick example. It sounds like it may be a lot better of a solution than what I am currently trying to work with, i.e., SELECTing INTO ARRAY, and then examining the ARRAY for count value. TIA, Chuck.



_TALLY is a system variable that keeps the count of the records in the last table processing command you ran. Look at the on-line help for this. Just make sure you either save the value of _Tally or use it before you run any other command that might change it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform