I'm needing to get a quick total (count) of the number of times a certain value appears in a field.
Am using a regular old VFP .dbf table with standard commands.
The deal is that I'm need to just count the values whose FIRST 2 Letters match a particular critera.
For example..the following is used to simply total up the number of records in a table that have GREEN for the value in the Field Color.
select sum(iif(Color = 'GREEN',1,0)) from c:\tables\style.dbf
I'm needing to total the number of records that have a value in the Color field that BEGINS WITH "GR"
So that...for example...the command would total up all records that have EITHER GRAY or GREEN in the Color field
Something like:
select sum(iif($left(Color,1,2) = 'GR',1,0)) from c:\tables\style.dbf
However....$left or $mid seem to cause errors.
Am I thinking to much VB here...or can FoxPro work with strings in this manner?
Thanks very much.
Am using a regular old VFP .dbf table with standard commands.
The deal is that I'm need to just count the values whose FIRST 2 Letters match a particular critera.
For example..the following is used to simply total up the number of records in a table that have GREEN for the value in the Field Color.
select sum(iif(Color = 'GREEN',1,0)) from c:\tables\style.dbf
I'm needing to total the number of records that have a value in the Color field that BEGINS WITH "GR"
So that...for example...the command would total up all records that have EITHER GRAY or GREEN in the Color field
Something like:
select sum(iif($left(Color,1,2) = 'GR',1,0)) from c:\tables\style.dbf
However....$left or $mid seem to cause errors.
Am I thinking to much VB here...or can FoxPro work with strings in this manner?
Thanks very much.