Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can Count(), CASE(), and Distrinct be combined?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01665760
Message ID:
01665765
Vues:
47
>Hi,
>
>I am trying to count unique values in the field (using SQL Select) if the value is greater than 0
>
>So, here is syntax I use (simplified) (which generates an error):
>
>select count( case when mytable.myfield = 0 then 0 else distinct( mytable.myfield ) end ) as TotCount
>
>
>What is wrong in the above syntax?
>
>TIA

Not sure I understood correctly, maybe you are looking for something like:
select (myField), COUNT(*) from myTable where myField <> 0 group by 1
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform