次の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 |
皆さん、私を助けてくれませんか?