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 杨志翔

  • 相关阅读:
    第十六周个人作业
    排球比赛积分程序
    本周个人总结
    本周个人总结
    排球积分规则
    我与计算机
    排球计分(实践)
    观后感
    18周 个人作业
    总结
  • 原文地址:https://www.cnblogs.com/21xz/p/1861629.html
Copyright © 2011-2022 走看看