选课系统中,教师有一个一键结束选课的功能,点击这个按钮需要将发布的课题topic表中的`releaseSingal`课题发布标志字段全部设置成‘0’,现在只知道登录教师的userId,需要通过userId来找到topic_teacher表(教师ID和课程ID)中的topicId,再通过topicId将topic表中releaseSingal 更新为0。
sql语句如下:
update topic t INNER JOIN
(select topicId from topic_teacher where userId=#{userId}) r
SET t.releaseSingal=0 WHERE t.topicId=r.topicId