Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Count of columns with value
Message
De
18/08/2008 07:10:24
 
 
À
18/08/2008 07:05:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01339464
Message ID:
01339465
Vues:
11
This message has been marked as the solution to the initial question of the thread.
>Hi
>I want to get the count of the column with specific value.
>In the following example Ihave to know how many columns with 'Y' (value can be 'Y' or empty)
>
create cursor mycursor (yellow c(1), grin c(1), blue c(1),total i)
>insert into mycursor (yellow,grin,blue) values ('','Y','Y')
>insert into mycursor (yellow,grin,blue) values ('Y','','Y')
>insert into mycursor (yellow,grin,blue) values ('Y','Y','Y')
>insert into mycursor (yellow,grin,blue) values ('','Y','')
>insert into mycursor (yellow,grin,blue) values ('Y','','Y')
>insert into mycursor (yellow,grin,blue) values ('','Y','Y')
>insert into mycursor (yellow,grin,blue) values ('Y','','')
>
>select mycursor
>scan
>	replace mycursor.total with ?&&count of columns with 'Y' value (0/1/2/3)
>endscan
Update mycursor set total=iif(yellow='Y',1,0) + iif(grin='Y',1,0) + iif(blue='Y',1,0)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform