select t1.requestid , t1.nodeid as 節點,t2.nodeid as 上一節點 ,
t2.operatedate as 接收日期 , t2.operatetime as 接收時間 ,t1.operatedate as 提交日期, t1.operatetime as 提交時間
from workflow_requestLog t1
left outer join workflow_requestLog t2 on t1.requestid=t2.requestid and t1.nodeid=t2.destnodeid and t1.LOGID>t2.LOGID
and t2.LOGID=(select max(LOGID) from workflow_requestlog where requestid=t1.requestid and destnodeid =t1.nodeid and LOGID< t1.LOGID )
在oracle中執行報錯

uj5u.com熱心網友回復:
陳述句上只能看出你的父節點有多個,并且你想取logid最大的。還是建議你把測驗資料和規則發出來select *
from workflow_requestLog t1,
(select t1.*
from workflow_requestLog t1
where t1.logid = (select max(v1.logid)
from workflow_requestLog v1
where t1.requestid = v1.requestid
and t1.nodeid = v1.nodeid)) t2
where t1.requestid = t2.requestid(+)
and t1.nodeid = t2.destnodeid(+);
uj5u.com熱心網友回復:
SELECT requestid , 節點,上一節點 ,接收日期 ,接收時間 ,提交日期,提交時間 FROM (
select t1.requestid , t1.nodeid as 節點,t2.nodeid as 上一節點 ,
t2.operatedate as 接收日期 , t2.operatetime as 接收時間 ,t1.operatedate as 提交日期, t1.operatetime as 提交時間,
MAX(T2.LOGID) OVER(PARTITION t2.requestid,t2.destnodeid) M,T2.LOGID
from workflow_requestLog t1
left join workflow_requestLog t2 on t1.requestid=t2.requestid and t1.nodeid=t2.destnodeid and t1.LOGID>t2.LOGID
) T WHERE T.M=T.LOGID ;
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/28090.html
標籤:基礎和管理
