要求:SQL语句按ID以最新时间查询最新的一条记录
方法1:
select * from (select *, ROW_NUMBER() over(partition by id order by updateDate desc) as num from table) b
where num=1 order by id
方法2:
select* from table where updateDate in(select max(updateDate) from table group by id)
参考:
http://www.cnblogs.com/lhws/archive/2012/03/20/2407522.html