SELECT buyplan.buyPlanNo,handState,buyplan.unitNo,buyplan.ownNo,ownof.ownName,
unit.unitname,goodsNo,buyTypeNo,buyWayNo,goodsName,onePrice,calculateUnit,buyCount,
totalPrice,technologyIndex,operatePeople,newAddTime,newAddPeople,updateTime,updatePeople,
groupNo,thisBuyBudget,buyReportState
FROM (SELECT ROWNUM rn,buyPlanNo,unitNo,ownNo,goodsNo,buyTypeNo,buyWayNo,goodsName,
onePrice,calculateUnit,buyCount, totalPrice,technologyIndex,operatePeople,
newAddTime,newAddPeople,updateTime,updatePeople, groupNo,thisBuyBudget,buyReportState
FROM g3_buyplan WHERE 1=1 ) buyplan,g3_process process,g3_unit unit,g3_ownoffice ownof
WHERE buyplan.unitno=unit.unitno AND buyplan.ownno=ownof.ownno AND buyplan.buyplanno=process.buyplanno
AND rn > 0 AND rn <= 10 AND handstate = 2
字段有點多,不過前面的那些個字段大神們可以忽略,主要是最後那句話:
“AND rn > 0 AND rn <= 10”這句是用來做分頁查詢的,在這寫上這個就什麼也查不出來,刪掉它就能查出數據。是位置寫錯了麼?
rn 沒有對應的結果集啊
oracle數據庫 select * from 表名 where 條件 把這怎麼查詢表的語句當成子查詢 select * from (子查詢) WHERE ROWNUM<=1
把你的整查詢語句除了AND rn > 0 AND rn <= 10 都當成一個子查詢 如上描述