mysql select top语句:
select * from tb_eleclog where uname='jimmy' order by time DESC limit 0, 1
---等价于:
select * from tb_eleclog where uname='jimmy' order by time DESC limit 1
参考:select top在七种数据库中的用法。
1、oracle数据库
select * from table1 where rownum<=n
2、infomix数据库
select first n * from table1
3、db2数据库
select * row_number() over(order by col1 desc) as rownum where rownum<=n
或者
select column from table fetch first n rows only
4、sql server数据库
select top n * from table1
5、sybase数据库
set rowcount n
go
select * from table1
6、mysql数据库
select * from table1 limit n
7、foxpro数据库
select * top n from table order by column