Mysql Percentages with multiple Group By -
i'm getting stuck on seems easy mysql task: counting data percentages of subtotals, given "with rollup" instruction.
i've searched internet lot, couldn't find works when have calculate partial percentages (that is, percentages when have grouped multiple columns)
here query:
select elements.*, plans.*, workers.*, count(action) counter elements join plans on elements.id_piano = plans.id_piano join workers on plans.id_collaboratore = workers.id_collaboratore group id_agency, category, action rollup
how can calculate each "counter" percentage of relative subtotal "with rollup" instruction gives??
really sorry trivial question, cannot done.
thanks in advance!
edit:
here now:
agency | category | action | counter alfa | skill | e-learning | 3 alfa | skill | coaching | 2 alfa | skill | null | 5 alfa | attitude | on-the-job | 2 alfa | attitude | null | 2 alfa | null | null | 7
and on...
here have:
agency | category | action | percentage alfa | skill | e-learning | 60% alfa | skill | coaching | 40% alfa | skill | null | 5 alfa | attitude | on-the-job | 100% alfa | attitude | null | 2 alfa | null | null | 7
and on...
in other words, calculate in way percentage relative first group criteria.
Comments
Post a Comment