Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL SELECT (*) with COUNT(*)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00387199
Message ID:
00388494
Vues:
14
>>>>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.



Barbara: Thanks a lot for the help. This is exactly what I needed.
Chuck Henry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform