让我们开始吧。
这将返回正确的结果:
SELECT sum(w.weight * w.repetitions)
FROM workout_exercise_logs w
JOIN workout_logs wo ON `w`.`workoutLogID`=`wo`.`workoutLogID`
JOIN workouts wor ON `wo`.`workoutID`=`wor`.`workoutID`
WHERE w.weightType=1 and `wor`.`userID`=34
但是当我添加时+ w.weight * w.seconds / 3
,我得到了一个NULL
结果:
SELECT sum(w.weight * w.repetitions + w.weight * w.seconds / 3)
FROM workout_exercise_logs w
JOIN workout_logs wo ON `w`.`workoutLogID`=`wo`.`workoutLogID`
JOIN workouts wor ON `wo`.`workoutID`=`wor`.`workoutID`
WHERE w.weightType=1 and `wor`.`userID`=34
表达式有什么问题,我该如何解决?谢谢!