第1个回答 2012-09-21
select * from table as a where exists
(select 1 from table where a.id=id group by id
having max(time)=a.time)本回答被网友采纳
第2个回答 2012-09-21
select top 1 from table order by time desc
DESC是排序,把你最后的时间,也是最新的一条,然后top 1是取这条数据。
第3个回答 2012-09-21
这个肯定行
select *
from tab t
where not exists (select 1 from tab where ID = t.ID and time > t.time)
如果要最早的纪录,只要把>换为<就可以了
第4个回答 2012-09-21
你按时间排序,然后拿出第一条。