Question : Using variables to find sum and percentage with Coldfusion and Access

Hello All,

I have a database of employees in different departments.  What we would like to do is create some kind of statistics.  

>Find out how many are Female and Male and their percentage.
>Find out the Ethnicity (which should just group all ethnicity in the Ethnicity field) and their total value and percentage.

To illustrate:

Gender:  
                          Female   9      64%     (9 divided by 14)
                          Male       5     36%      (5 divided by 14)
      Total Gender:             14    100%

Ethnicity:  Should be dynamic in a sense that it should group the value in the Ethnicity field.  You can really list this manually.

                          Latino       3    21%   (3 divided by 14)
                          Asian        4    29%   (4 divided by  14)
                          Af-Amer    6    43%
                          Caucasian  1      7%

Additional Info:  I have a query from a database and I need to create variables out of that query.  These variables will be added and also apply division operation to get the percentage shown above.

Thanks


Answer : Using variables to find sum and percentage with Coldfusion and Access

The query would return something like this:
Gender  Gender_Count
---------------------------
Male          6
Female      9
 
To get the total count you could do:
list(query_name.Gender_Count)))>

Then to output :

#gender# #gender_count# #evaluate(gender_count/total_count)#

Random Solutions  
 
programming4us programming4us