三种常用数据库(Oracle、MySQL、SQLServer)分页


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






你可能感兴趣的:(三种常用数据库(Oracle、MySQL、SQLServer)分页)