我有以下mysql查询:
SELECT mm_strength.strengthId, mm_strength.date, sum(mm_strength_set.weight) AS total, round(sum(mm_strength_set.weight)/count(mm_strength_set.weight),1) AS average, max(mm_strength_set.weight) AS high
FROM mm_strength
INNER JOIN mm_strength_set
ON mm_strength.strengthId = mm_strength_set.strengthId
WHERE mm_strength.exerciseId = '31' AND mm_strength.customerId = '4'
GROUP BY mm_strength.strengthId
ORDER BY mm_strength.strengthId
DESC
LIMIT 5
结果是:
| strengthID | date | total | average | high | progress??
| 403 | 2013-06-08 | 32.5 | 10.8 | 12.5 | avg 10.8-prior avg 10 = 0.8
| 357 | 2013-06-04 | 30.0 | 10.0 | 10.0 | avg 10.0-prior avg 8 = 2.0
| 334 | 2013-06-02 | 24.0 | 8.0 | 8.0 | avg 8-0 (no prior) = 8.0
我已经尝试了所有方法,但似乎找不到创建以下第 6 列的好方法(进度应显示上一行的平均值增加):
| progress |
| 0.8 |
| 2.0 |
| 8.0 |
你们能帮帮我吗?