SELECT
EvidenceDescriptor.evidenceDescriptorID,
caseID,
participantID,
statusCode,
receivedDate,
effectiveFrom,
correctionSetID,
successionID,
relatedID,
evidenceType,
pendingRemovalInd,
pendingUpdateInd,
newInd,
approvalRequestedInd,
sharedInd,
versionNo,
MAX(changeDateTime) as changeDateTime
INTO
:evidenceDescriptorID,
:caseID,
:participantID,
:statusCode,
:receivedDate,
:effectiveFrom,
:correctionSetID,
:successionID,
:relatedID,
:evidenceType,
:pendingRemovalInd,
:pendingUpdateInd,
:newInd,
:approvalRequestedInd,
:sharedInd,
:versionNo,
:changeDateTime
FROM
EvidenceDescriptor,
EvidenceChangeHistory
WHERE caseID = :caseID
AND statusCode = :statusCode
AND EvidenceDescriptor.evidenceDescriptorID = EvidenceChangeHistory.evidenceDescriptorID
GROUP
BY EvidenceDescriptor.evidenceDescriptorID,
caseID,
participantID,
statusCode,
receivedDate,
effectiveFrom,
correctionSetID,
successionID,
relatedID,
evidenceType,
pendingRemovalInd,
pendingUpdateInd,
newInd,
approvalRequestedInd,
sharedInd,
versionNo
ORDER BY changeDateTime
|