zoukankan      html  css  js  c++  java
  • 分页

    自己写的分页查询语句

    默认分类 2009-12-15 11:47:36 阅读14 评论0   字号: 订阅

    最常用简单分页

    select top 20 * from feedback_form where id not in (select top 页码*20 id from feedback_form WHERE 1=1 and status>0 and status < 5 order by id desc) order by id desc

    sql="select top "&size&" * from

    (select TOP 100 PERCENT

    substring([cityKey],charindex(':',[cityKey])+1,len([cityKey]) -charindex(':',[cityKey])) as a,developer,salesPhone,childId,buildName,fieldPosition,overviewPhoto,equalPrice,C.unitType,left([cityKey],charindex(':',[cityKey])-1) as pid,C.outPhoto

    from hellohouse_houseChild as C join hellohouse_houseRoot as R on C.rootId=R.rootId

    where "&whereStr1&" order by childId desc) as a where childId not in (select top ("&size&"*"&page-1&") childId

    from (select TOP 100 PERCENT

    substring([cityKey],charindex(':',[cityKey])+1,len([cityKey]) -charindex(':',[cityKey])) as a,developer,salesPhone,childId,buildName,fieldPosition,overviewPhoto,equalPrice,C.unitType,left([cityKey],charindex(':',[cityKey])-1) as pid,C.outPhoto

     from hellohouse_houseChild as C join hellohouse_houseRoot as R on C.rootId=R.rootId

    where "&whereStr1&" order by childId desc) as b order by childId desc) order by childId desc"

    用于www.whhouse.com 的最新楼盘分页查询~太复杂了啊~效率也没达人的好,不过总算能解决问题了

    2009-12-15 杨志翔

  • 相关阅读:
    css bug(ie6兼容问题)
    css样式之vertical-align垂直居中的应用
    css浮动
    样式属性(1)
    DOM对象,控制HTML元素(1)
    用户注册
    Kaggle竞赛 —— 泰坦尼克号(Titanic)
    Spring框架第六篇之Spring与DAO
    Spring框架第五篇之Spring与AOP
    Spring框架第四篇之基于注解的DI注入
  • 原文地址:https://www.cnblogs.com/21xz/p/1861629.html
Copyright © 2011-2022 走看看