Hello All!

I have a MySQL database with 4 items, id (numerical), group_name, employees, and surveys.

I need to in my select calulate the percentage of 'employees' who my the number in 'surveys' have taken the survey.

This is the statement I have now:

SELECT group_name, employees, surveys, COUNT( surveys ) AS percentage, 
            ((COUNT( * ) / ( SELECT COUNT( * ) FROM db_test)) * 100 ) AS percentage
        FROM db_test
        ORDER BY surveys

So lets get this right and clarify, are you saying for instance if the total No of employees is 100,
and the total No of surveys is 50, you want an answer of 50% ??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.