`

不同数据库,sql语句不同

阅读更多

1.

sql server支持top.

select top 4 from table

 

2.

mysql 支持的是limit.

select * from table limit 4

 

3.

oracle 不支持top与limit语法,
如果要实现 select top n,
可以用order by +ROWNUM 来实现 。


select * from table where rownum<=4 order by id

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics