mysql,mssql,oracle分页通用sql语句

来源:互联网 发布:破解营销软件 编辑:程序博客网 时间:2024/05/01 18:16
 要定义的变量→当前页数:curr       每页显示条数:page

  • Mysql :Select from 表名 limit (curr-1)*page
  • MSsql2000:Select top page * from 表名 where 主键 not in (select top (curr-1)*page                                                        主键 from 表名 order by 主键)
  • Oracle:Select * from (Select rownum temp_rownum,temp_table.* from (Select * from 表名
                   ) temp_table where  rownum< curr * page + 1) where temp_rownum>= (curr - 1) * page + 1
                   order by 主键 desc
原创粉丝点击