zoukankan      html  css  js  c++  java
  • mssqlserver,mysql,oracle分页查询

    分页查询语句是sql语句编程中很长见的一个典型应用,用sql语句来分页比一些分页控件的速度要快,所以sql语句的分页在实际编程应用中还是非常广泛的。

    今天给大家分享几条不同数据库编程用的分页查询语句。我以查询21条 - 30条 为例。

    01 --mssqlserver的分页查询语句:
    02  
    03 select top 10 * from t where id not in (select top 20 id from t order by id ) orderby id 
    04  
    05 --或者
    06  
    07 select top 10 * from t where id in (select top 20 id from t order by id) order by iddesc 
    08  
    09 --mysql的分页查询语句:
    10  
    11 select * from t order by id limit 20,10 
    12  
    13 --oracle的分页查询语句:
    14  
    15 select * from (select rownum r,* from t where r<=30) where r>20


    赶快去试试吧!

    魔由心生,有万境纵横,无一道清静,无量寿佛!
  • 相关阅读:
    Liunx cal
    Liunx read
    IOS
    IOS
    ARPSpoofing教程(四)
    ARPSpoofing教程(三)
    ARPSpoofing教程(二)
    数据结构与算法分析
    hdu 2034
    hdu 2042
  • 原文地址:https://www.cnblogs.com/qihuan/p/3577497.html
Copyright © 2011-2022 走看看