Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can Count(), CASE(), and Distrinct be combined?
Message
De
28/01/2019 15:39:55
 
 
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:
01665761
Vues:
59
>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?

I am not aware of that syntax in SQL. It might work but I've never used it. With what I know, I would use this:
SELECT DISTINCT mytable.myfield FROM mytable WHERE mytable.myField != 0 INTO CURSOR tmp1
? _TALLY  && Display the distinct count
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform