如何一次更新2列?
我尝试了以下语句,但不起作用:
UPDATE exercises SET times_answered = times_answered + 1 AND av_answeringTime = av_answeringTime + ( (av_answeringTime / (times_answered) ) + ?) * (times_answered + 1) WHERE name = ?
Chad Birch.. 53
使用逗号而不是"AND":
UPDATE exercises SET times_answered = times_answered + 1, av_answeringTime = av_answeringTime + ( (av_answeringTime / (times_answered) ) + ?) * (times_answered + 1) WHERE name = ?
Ayman.. 34
SQL UPDATE语法是:
UPDATE table SET column1 = value1, column2 = value2 WHERE condition
而不是AND你需要一个逗号
使用逗号而不是"AND":
UPDATE exercises SET times_answered = times_answered + 1, av_answeringTime = av_answeringTime + ( (av_answeringTime / (times_answered) ) + ?) * (times_answered + 1) WHERE name = ?
SQL UPDATE语法是:
UPDATE table SET column1 = value1, column2 = value2 WHERE condition
而不是AND你需要一个逗号
尝试这样的事......
UPDATE exercises SET times_answered = times_answered + 1, av_answeringTime = av_answeringTime + ( (av_answeringTime / (times_answered) ) + ?) * (times_answered + 1) WHERE name = ?