oracle、SQL Server、Mysql分页语句备忘

定义:pageStart 起始页,pageEnd 终止页,pageSize页面容量

oracle分页:

    

select * from ( select mytable.*,rownum num from (实际传的SQL) where rownum<=pageEnd) where num>=pageStart

sqlServer分页:

select * from ( select top 页面容量 from( select top  页面容量*当前页码 * from 表 where 条件 order by 字段A) as temptable1 order by 字段A desc) as temptable2 order by 字段A 

Mysql分页:

select * from mytable where 条件 limit 当前页码*页面容量-1 to 页面容量



你可能感兴趣的:(SQL Server)