Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to count records in a Select Statement
Message
 
À
09/11/1998 10:23:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00155722
Message ID:
00155725
Vues:
19
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform