I have a table with some project data. One column contains “Completion %”. By default the value is set to 0. What is the best way to structure the mySQL query and write a code to get the following 3 values:
- total users (every row WHERE PROJECT = 5)
- participants (WHERE PROJECT = 5 AND completion != 0)
- average completion rate (average of the % of participants)
I don’t think I can do it all in a single query…
Thanks
It would be helpful in the future if you run
SHOW CREATE TABLEof your table and include it in your question.Re comment: So it sounds like your table is something like this:
I have edited my suggested query above to match.