sql语言的分页查询

来源:互联网 发布:java bigdecimal int 编辑:程序博客网 时间:2024/05/22 23:52

在 MySQL 中表示为:

select * from userlist  order by userId limit n,m

MS SQL Server 中 :
select top (m-n) * from userList where userid not in
(select top  n userid from userList  order by userid) order by userid

Oracle 中 :
select * from (select rownum no,* from userlist where rownum<=m) where no>=n;

 

注意:order by 后面的字段最好是主键或是唯一值了

原创粉丝点击