57,065
社区成员
发帖
与我相关
我的任务
分享
select a.id,a.name ,b.subject
from table1 A join
(select max(score) as bestscore,subject from table1 group by subject) B
on A.subject=b.subject and A.score=b.bestscore
我这里没有mssql记得是这样写
select id,name
from table1 A join
(select max(score) as bestscore,subject from table1 group by subject) B
on A.subject=b.subject and A.score=b.bestscore
手打的应该问题不大
另外不管什么sql应该是在windows和linux下应该一样
倒是mysql用limit代替mssql的top