Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to count records in a Select Statement
Message
 
To
09/11/1998 10:23:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00155722
Message ID:
00155725
Views:
20
>Hello Fellow Developers
> I have a question about a select statement that I am creating. I am trying to grab the top 10 records that meat a certian type of criteria in a database. I know about the cnt command but every time I use this I get a single record with my table count. I was wondering if this was possible to do in a select statement or if I have to select disting and the scan through and count ?
>
>Please help with suggestions
>
Hi Darren In Atlanta,

You can include the CNT() function in the select statement such as:
SELECT *, CNT(*) AS Num;
  FROM Mytable;
  GROUP BY Fieldname;
  INTO CURSOR Foo
The Num field will contain the number of records that are in each group.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform