FWQ
如何使用MySQL left join 更新学生表中成绩字段为对应学生在成绩表中的最高分?
left join 实现多条数据中某字段最大值的更新 在mysql中,对于更新student表中score字段的值,使其等于score表中对应student_id的最大值,可以使用以下方法: 查询语句: update student set score=(select max(score) from score where score.student_id=student.id) 登录后复制 解释: left join: 将student表和score表以student_id列进行连接,对于student表中的每一行,找出score表中对应的最大score值。 max(score): 获取得分表中特定学生得分的最大值。 where score.student_id=student.id: 确保score表的student_id与student表的student_id匹配。 update student set score=():…