How can I calculate a percentage within an array across two tables
Posted on 2014-08-02
For each "item_id" listed in the "training_items" table, I need to determine/display an overall completion rate (percentage).
I have two tables:
- date_completed (default is NULL) -- when the user completes the training, it is updated with date()
My thought is, for each item_id in the training_items table, count the number of times that item_id has a NULL date_completed in the user_training_items table and divided it by the total number of times the item_id appears within that table.
I'm hoping someone out there can provide some insight/script on how I can actually pull this off.