From 209d393ac505c813edaef0ab4b992ce7f48b6fe9 Mon Sep 17 00:00:00 2001 From: mullenm Date: Tue, 26 Feb 2008 11:07:26 +0000 Subject: [PATCH] Updated view to pick current status based on event_date rather than ID. This fixes an issue with me picking the wrong sequence. I've also corrected that. git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3705 248e525c-4dfb-0310-94bc-949c084e9493 --- Schema/V_CURRENT_DOCUMENT_STATUS.vw | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Schema/V_CURRENT_DOCUMENT_STATUS.vw b/Schema/V_CURRENT_DOCUMENT_STATUS.vw index 50ad164..73aa8d3 100644 --- a/Schema/V_CURRENT_DOCUMENT_STATUS.vw +++ b/Schema/V_CURRENT_DOCUMENT_STATUS.vw @@ -6,6 +6,7 @@ SELECT docu_id ,event_date ,dost_code ,id - ,MAX(id) over(PARTITION BY docu_id) AS max_id + ,MAX(event_date) over(PARTITION BY docu_id) AS max_date FROM document_events) - WHERE id = max_id; + WHERE event_date = max_date +