資料查詢(SQL)??暈啊! 表:學號 姓名 成績 時間1 a 55 20042 b 85 2005.....查出成績最高的,如果成績最高有多個,找出時間最近的那一個. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from table order by 成绩,时间拿第一条 select max(a.成绩)from (select 成绩,max(时间) as 时间from 表名group by 成绩) a select * from table order by 成绩 desc,时间desc order by 成绩,时间 我在ORACLE里面试的:select max(成绩) as MaxChenji, max(时间) as MaxShijianfrom TabName如果最高成绩相同的记录中,时间最近的也有多个,应该会一并全部查出。 select max(成績)as 最高成績,max(時間)as 最近時間 from table select max(成績)as 最高成績,max(時間)as 最近時間 from table老大们,你们这样来做,这个时间和成绩还是对应关系的么?这会产生不正确的结果。 select * from table order by 成绩 desc,时间desc正解select max(a.成绩)from (select 成绩,max(时间) as 时间from 表名group by 成绩) a正解 select top 1 from table order by 成绩 desc,时间desc select * from table order by 成绩 desc,时间descselect max(a.成绩)from (select 成绩,max(时间) as 时间from 表名group by 成绩) a select * from table order by 成绩 desc,时间desc在顶一次 select top 1 * from table order by 成绩 desc,时间desc select top 1 * from table order by 成绩 desc,时间desc 是正解。 select max(a.成绩)from (select 成绩,max(时间) as 时间from 表名group by 成绩) a这种方法只得到了一个成绩字段,而是那一个学生考出来的不知道. select top 1 * from table order by 成绩 desc,时间desc 这个查询速度最快, 请教2表连接的sql语句 delphi 简单插入语句 数据库记录判断问题? 如何从mcisendstring中返回position和length?? 这段代码是同时在两张表中插入数据为何不对. 由VCL代码理解VCL的消息机制 用什么样数据库? 关于一个集成自TGraphicControl控件为什么放在窗体上没有反应.好像是因为我的paint没有事,大家帮我看看! 如何直接删除文件夹以及里面的所有文件?(没有子文件夹) 软件共享 怎么载入notepad 中的字符 感觉delphi自带的控件太不好用了,做东西狠别扭,大家都什么感觉??
from
(select 成绩,max(时间) as 时间
from 表名
group by 成绩) a
select max(成绩) as MaxChenji, max(时间) as MaxShijian
from TabName如果最高成绩相同的记录中,时间最近的也有多个,应该会一并全部查出。
from
(select 成绩,max(时间) as 时间
from 表名
group by 成绩) a正解
from
(select 成绩,max(时间) as 时间
from 表名
group by 成绩) a
from
(select 成绩,max(时间) as 时间
from 表名
group by 成绩) a这种方法只得到了一个成绩字段,而是那一个学生考出来的不知道.
这个查询速度最快,