I usually use rank () to get the latest version of a time-based entry. It assigns the rank of each version of the record based on the key that you provide (section: in this case, the request identifier). If you order in descending order, rows with a rank of 1 are the newest. If you order asc, rows with a rank of 1 are the oldest.
EDIT: Changed the name of the RequestId column that was returned in the subquery to remove the error you saw.
SELECT P.ID AS PacketID, R.ID AS RequestID, A.ID AS ActionID, A.EmpID, P.DateStamp, RQ.Description AS RequestType, L.Description AS Line, R.PartNo, R.Workorder, R.Qty, RZ.Description AS ReasonType, R.MTF, S.Description AS Status FROM Packet AS P LEFT OUTER JOIN Request AS R ON R.PacketID = P.ID INNER JOIN ( select req.ID as RequestIdForJoin , act.* , rank() over (partition by req.ID order by act.DateStamp desc) as [Rank] from Request as req inner join Action as act on req.ID = act.RequestID ) as A on R.ID = A.RequestIdForJoin INNER JOIN RequestType AS RQ ON R.RequestTypeID = RQ.ID INNER JOIN Line AS L ON R.LineID = L.ID INNER JOIN ReasonType AS RZ ON R.ReasonTypeID = RZ.ID INNER JOIN Status AS S ON A.StatusID = S.ID where A.[Rank] = 1
For repetitive actions: If the @Hogan script for multiple actions with the same timestamp is possible, you can execute and remove duplicates as follows:
declare @View table ( PacketID int, RequestID int, ActionID int, EmpID int, DateStamp datetime, RequestType int, Line int, PartNo varchar(50), Workorder int, Qty int, ReasonType int, MTF varchar(50), Status int ) insert into @View SELECT P.ID AS PacketID, R.ID AS RequestID, A.ID AS ActionID, A.EmpID, P.DateStamp, RQ.Description AS RequestType, L.Description AS Line, R.PartNo, R.Workorder, R.Qty, RZ.Description AS ReasonType, R.MTF, S.Description AS Status FROM Packet AS P LEFT OUTER JOIN Request AS R ON R.PacketID = P.ID INNER JOIN ( select req.ID as RequestIdForJoin , act.* , rank() over (partition by req.ID order by act.DateStamp desc) as [Rank] from Request as req inner join Action as act on req.ID = act.RequestID ) as A on R.ID = A.RequestIdForJoin INNER JOIN RequestType AS RQ ON R.RequestTypeID = RQ.ID INNER JOIN Line AS L ON R.LineID = L.ID INNER JOIN ReasonType AS RZ ON R.ReasonTypeID = RZ.ID INNER JOIN Status AS S ON A.StatusID = S.ID where A.[Rank] = 1