我正在尝试根据每条记录的其他列中的值来更新新的“ rubricscore”列。也就是说,如果一列具有特定的字符串值,我将在总数中加1,如果它具有不同的值,则我将添加2。每列有3个可能性。我需要对5列进行此操作。然后,无论总值是多少,我都将使用该值更新新的“ rubricscore”列。到目前为止,我已经知道了:
SELECT id, @runtot AS rt,
CASE
WHEN classroommanagment = 'Self direction' THEN @runtot := @runtot + 1
WHEN classroommanagment = 'Restating directions' THEN @runtot := @runtot + 2
WHEN classroommanagment = 'Moving' THEN @runtot := @runtot + 3
WHEN teacherrole LIKE '%Mini lesson%' THEN @runtot := @runtot + 1
WHEN teacherrole LIke '%Managing%' THEN @runtot := @runtot + 2
WHEN teacherrole LIKE '%Moving%' THEN @runtot := @runtot + 3
and etc for the remaining three colomns
END
FROM RUBERIC