Code: Select all
SELECT R.r_id,S.s_type, S.s_name, S.s_region, SUM(R.r_assess1) AS TOTAL_EXERCISE1, SUM(R.r_assess2) AS TOTAL_EXERCISE2
FROM results AS R INNER JOIN schools AS S
ON (R.r_id = S.s_id)
GROUP BY R.r_id
HAVING SUM(R.r_assess1) > 0
ORDER BY S.s_region ASC, S.s_type ASC
In math it's just [ (TOTAL_EXERCISE2 - TOTAL_EXERCISE1) / (TOTAL_EXERCISE1) ] * 100,
how can I get this extra column in the result sheet?