SELECT *, 100 * dwindle / total AS percentage FROM ( SELECT buyer, sum(saleTotal) as total, sum(saleWaste) as dwindle FROM bs.waste w JOIN vn.time t ON w.year = t.year AND w.week = t.week WHERE t.dated = DATE_ADD(CURDATE(), INTERVAL -1 WEEK) GROUP BY buyer ) sub ORDER BY percentage DESC;