Forum

LAST WORKLOG OF THE HISTORY

  • 1.  LAST WORKLOG OF THE HISTORY

    Posted 06-05-2020 16:32
    Query to get the last Worklog of the history for each ticket:

    select slice, item_id, display, created_by, created_date,maxdate, history_type from (select MAX (created_date) MAXDATE, ITEM_ID AS BID from VAPP_HISTORY_ALL_UX WITH (NOLOCK) where history_type = 'Worklog' GROUP BY ITEM_ID) A left JOIN VAPP_HISTORY_ALL_UX B WITH (NOLOCK) ON B.item_id = A.BID and B.created_date = A.maxdate and history_type = 'Worklog'

    This query can be used in a DERIVED TABLE and then join left with VAPP_ITEM, to obtain a detail of the tickets with the last record saved in the Activity History

    JOIN IS: