34,576
社区成员
发帖
与我相关
我的任务
分享
--5楼的有问题
select * from tb
where not exists(select 1 from tb b where tb.课程=b.课程 and tb.成绩 <b.成绩)
select a.* from tb a
join (select 科目,max(成绩) from tb group by 科目) b
on a.科目=b.科目 and a.成绩=b.成绩
select t.* from 表 t where not exists(select 1 from 表 where 科目=t.科目 and 成绩>t.成绩)
1
这个应该可以啊 select t.* from 表 t where not exists(select 1 from 表 where 科目=t.科目 and 成绩>t.成绩)
还有可以利用CHECK什么的也可以
1
select t.* from 表 t where not exists(select 1 from 表 where 科目=t.科目 and 成绩>t.成绩)
2
select ID ,Name,課程 max(分數)from tb group by ID ,Name,課程