【发布时间】:2012-05-16 01:46:36
【问题描述】:
让我们开始吧。
这会返回正确的结果:
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
表达式有什么问题,我该如何解决?谢谢!
【问题讨论】: