MySQL:
select top 1 * from tablename order by 时间 desc
Oracle:
select * from (select *,rownum as sn from tablename order by 时间 desc) as t where sn=1
SELECT * from tablename where 时间=(select max(时间) from tablename)
本文介绍在MySQL、Oracle和SQL标准中如何使用SQL语句查询表中的最新记录,通过三种不同的数据库系统展示具体实现方法。
MySQL:
select top 1 * from tablename order by 时间 desc
Oracle:
select * from (select *,rownum as sn from tablename order by 时间 desc) as t where sn=1
SELECT * from tablename where 时间=(select max(时间) from tablename)

被折叠的 条评论
为什么被折叠?
