`
qinya06
  • 浏览: 583111 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

mysql oracle sql server 分页

阅读更多
SQL server分页:

Sql代码
select top pageSize * from products where productID not in (select top (pageindex-1)*pageSize productId  from products order by ProductID asc) order by ProductID asc  



MySql分页:

Sql代码
select * from tableName limit 10,20  


oracle 分页:

Sql代码
select * from    
(select a.*,rownum row_num from    
(select * from mytable t order by t.id desc ) a   
) b where b.row_num between 1 and 10  




纯SQL
--第11条到第30条,共选出20条记录    
select *  from (select top 20 * from (select top 30 * from 表名 order by ID) t1 order by ID desc) t2  order by ID   


 select top 20 *  from 表名  where ID>(select max(ID) from (select top 10 ID from 表名 order by ID) t1)  order by ID  


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics