分页语句

取出sql表中第31到40条的记录(以自动增长ID为主键):

Sql Server 下:

方案1:select top 10 * from t where  id not in (select top 30 id form t order by id) order by id;

方案2:select top 10 * from t where id in (select top 40 id from t order by id) order by id desc;

MySql 下:

select * from t order by id limit 30,10;

Oracle 下:

select * from (select rownum r,* from t where r<40) where r>30;

 

 

posted @ 2013-08-13 17:46  残星  阅读(409)  评论(0编辑  收藏  举报