有表
CREATE TABLE 成绩表
(
学号 varchar(50) NULL,
课号 varchar(50) NULL,
成绩 decimal(18, 1) NULL
)
取每课号前两名的学号和成绩并按课号和成绩排序:
select 课号,学号,成绩 from 成绩表 as t1 where (select count(*) from成绩表 as t2 where t1.课号=t2.课号 and t1.成绩>t2.成绩)<2 order by 课号,成绩 desc
posted @ 2007-04-12 00:20
七月(Lost) 阅读(72)
评论(0) 编辑 收藏