17,740
社区成员
发帖
与我相关
我的任务
分享
有一学生成绩表
create table scores
(
SID INT NOT NULL,--学生编号
CLASS_ID INT ,--班级
SCORE FLOAT,--分数
classpank int ,--班内名次(默认值为NULL)
............
)
update scores set classpank =( select count(1) from scores where classpank>=1 )+1 where CLASS_ID in ( select CLASS_ID from scores SCORE = (select max(SCORE) from scores ) )