WITH A AS ( SELECT DISTINCT TK.RootID, A.ITEM15 , A.ITEM16 , A.ITEM4 , A.ITEM6 , A.ITEM8 , A.ITEM10 FROM TASK TK LEFT JOIN ART05801584407735351_Log B ON TK.TskID = B.TskID LEFT JOIN ART05801584407735351_Ins A ON B.InsID = A.InsID WHERE 1=1 AND A.ITEM15 <>'') SELECT A.ITEM15 聯單編號 , A.ITEM16 申請日期, A.ITEM4 機關名稱, A.ITEM6 申請人, A.ITEM8 申請人EMAIL, A.ITEM10 申請人連絡電話, TK.State, CASE TK.State WHEN 'complete' THEN '結案' WHEN 'running' THEN '執行中' END 案件狀態 FROM A LEFT JOIN Task TK ON A.ROOTID = TK.RootID WHERE TK.TYPE = 'root'
2021-01-21
[AgentFlow]目前流程內容與狀態SQL
建議開發表單時先將RootID先帶入表單,不然要抓資料就很麻煩
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言