sqlserver版
select * from VersionMenu order by id
--获取21-30条记录
--1:
select Top 10 * from VersionMenu where 1=1 and id not in (select Top 10 id from VersionMenu order by id) order by id
--2:
select * from
(select *, ROW_NUMBER() OVER (order by ID) AS ROWNUM from VersionMenu) t where ROWNUM between 21 and 30
--3:
select top 10 * from VersionMenu where ID> (select max(ID) from
(select top 10 ID from VersionMenu order by ID) t1) order by ID
MySql查询
mysql> SELECT * FROM table LIMIT 20,10; // 检索记录行 21-30
//为了检索从某一个偏移量到记录集的结束所有的记录行,可以指定第二个参数为 -1:
mysql> SELECT * FROM table LIMIT 95,-1; // 检索记录行 96-last.
//如果只给定一个参数,它表示返回最大的记录行数目:
mysql> SELECT * FROM table LIMIT 5; //检索前 5 个记录行
//换句话说,LIMIT n 等价于 LIMIT 0,n
oracle:
select * from (select rownum no,* from 表名 where rownum<=30 ) where no >20;