问题描述:
Student为学生表,StudentCourse为学生选课表,并非所有的学生均选课,现需要将已选课学生所选课的CourseScheduleID复制到Student表对应学生的CourseScheduleID。
SQL语句如下:
update (select Student.CourseScheduleID as a ,StudentCourse.CourseScheduleID as b from Student,StudentCourse where Student.StudentID=StudentCourse.StudentID) c set c.a=c.b
Student为学生表,StudentCourse为学生选课表,并非所有的学生均选课,现需要将已选课学生所选课的CourseScheduleID复制到Student表对应学生的CourseScheduleID。
SQL语句如下:
update (select Student.CourseScheduleID as a ,StudentCourse.CourseScheduleID as b from Student,StudentCourse where Student.StudentID=StudentCourse.StudentID) c set c.a=c.b