码迷,mamicode.com
首页 > 数据库 > 详细

一个SQL题

时间:2016-04-27 11:03:03      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:sql

题目如图:

技术分享

模拟题目建的表如下图:

技术分享

答案:

select t3.id,t3.name,max(t3.score) from (
select t1.* from b t1,(select id,max(score) score from b group by id) t2 where t1.id=t2.id and t1.score<t2.score
) t3 group by t3.id;


本文出自 “屌丝逆袭” 博客,请务必保留此出处http://5731674.blog.51cto.com/5721674/1768128

一个SQL题

标签:sql

原文地址:http://5731674.blog.51cto.com/5721674/1768128

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!