3つの共通データベース(Oracle、MySQL、SQLServer)ページング
484 ワード
pageNow:
pageSize:
MySQL :
select * from tableName limit (pageNow-1)*pagesize,pagesize
SQLServer :
select top pageSize *
from tableName
where id not in (select top pageSize * (pageNow - 1) id from tableName);
Oracle :
select t.*
from(
select rownum sn,te.*
from tableName te
where rownum <= pageSize * pageNow
)t where t.sn > num * (pageNow - 1);
詳細:http://blog.csdn.net/wentasy/article/details/8200635