Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Counting field values in a table....
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00345652
Message ID:
00345656
Vues:
14
Dennis,

You can use
SELECT color, count(*) as total ;
   FROM (yourtable) ;
   GROUP BY color
to get the sub totals, and then
SELECT "all" as color, count(*) as total ;
   FROM (yourtable)
to get all of the colours. If you're careful with the literal in the second select, you colud even UNION the clauses.

Cheers,

Andrew


>I need to count the number of occurrences of certain field values...
>
>i.e.
>
>field ... color
>
>I need to get a count of records with values red, green, blue, etc.
>
>then a total of all records...
>
>I found a cube function which works with sql server but foxpro doesn't seem to like it...
>
>Is there another way to do this in foxpro...
>
>Thanks,
>
>Dennis


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform