`

分页sql语句

阅读更多
SQLServer:     
    
  SELECT   *   FROM     
            (     
            SELECT   TOP(PageSize)   *   FROM     
            (     
                      SELECT   TOP   (PageSize   *   PageIndex)   *     
                      FROM   Articles     
                      ORDER   BY   id   DESC     
            )     
            ORDER   BY   id   ASC     
  )     
  ORDER   BY   id   DESC     
    
  Oracle:     
    
    
  select   *   from   (     
    select   rownum   num,t1.*     
      from   table   t1   where   fast=0     
  )   where   num>=intPosition   and   num<=intEndPosition

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics