您的位置:首页 > 数据库 > Oracle

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

2008-03-09 12:09 736 查看
要定义的变量→当前页数: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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: