ALTER VIEW [dbo].[VWPMO_WF_ACTIVE] AS
SELECT TOP 100 PERCENT
	T.GUID AS WF_TASK_ID, 
	T1.TITLE, 
	T.RECORD_ID, 
	T.STATE_ID, 
	T2.STATE_DESC,
	T2.COLOR,
	T.COMMENT, 
	T.DUE_DATE, 
	T.TASK_DATE,
	'' AS USERNAME, 
	T.ADDED_WHEN, 
	T.CHANGED_WHO, 
	T.CHANGED_WHEN
FROM            
	TBPMO_WORKFLOW_TASK AS T,
    TBPMO_WORKFLOW AS T1,
	TBPMO_KONFIGURATION TK,
	TBPMO_WORKFLOW_TASK_STATE T2

WHERE 
	TK.GUID = 1 AND
	T.WF_ID = T1.GUID AND 
	T.STATE_ID = T2.GUID AND
	T.STATE_ID <> TK.WORKFLOW_FINAL_STATE1 
ORDER BY T.GUID
GO


