日期:2014-05-18 浏览次数:20465 次
SELECT V_APPROVAL_WORK_ITEM.ENTITY_NAME , V_APPROVAL_WORK_ITEM.ENTITY_NO , V_APPROVAL_WORK_ITEM.SUMMARY , ENTITY_WF_INST.START_DATE , V_APPROVAL_WORK_ITEM.ENTITY_ID , V_APPROVAL_WORK_ITEM.ENTITY_TYPE , V_APPROVAL_WORK_ITEM.FLOW_TYPE,MIN(APPROVAL_NO),MIN(CATE_APPROVAL_NO) FROM dbo.V_APPROVAL_WORK_ITEM INNER JOIN dbo.ENTITY_WF_INST ON dbo.V_APPROVAL_WORK_ITEM.ENTITY_TYPE = dbo.ENTITY_WF_INST.ENTITY_TYPE AND dbo.V_APPROVAL_WORK_ITEM.ENTITY_ID = dbo.ENTITY_WF_INST.ENTITY_ID WHERE CUR_USER_ID = 29 AND APPROVAL_NO IN ( SELECT MIN(APPROVAL_NO) FROM V_APPROVAL_WORK_ITEM a WHERE a.Entity_ID = V_APPROVAL_WORK_ITEM.Entity_ID AND a.Entity_TYPE = V_APPROVAL_WORK_ITEM.ENTITY_TYPE ) AND CATE_APPROVAL_NO IN ( SELECT MIN(CATE_APPROVAL_NO) FROM V_APPROVAL_WORK_ITEM a WHERE a.Entity_ID = V_APPROVAL_WORK_ITEM.Entity_ID AND a.ENTITY_TYPE = V_APPROVAL_WORK_ITEM.ENTITY_TYPE ) GROUP BY V_APPROVAL_WORK_ITEM.ENTITY_NAME , V_APPROVAL_WORK_ITEM.ENTITY_NO , V_APPROVAL_WORK_ITEM.SUMMARY , ENTITY_WF_INST.START_DATE , V_APPROVAL_WORK_ITEM.ENTITY_ID , V_APPROVAL_WORK_ITEM.ENTITY_TYPE , V_APPROVAL_WORK_ITEM.FLOW_TYPE ORDER BY dbo.ENTITY_WF_INST.START_DATE DESC