Database SQL Operation: TaskAssignment.searchUnreservedByRelatedNameAndLongestAssignedDateTime
Description: | Returns the identifiers of the tasks assigned to the specified user and which have been assigned to that object for longest period of time. |
Sterotype: | nsmulti |
SELECT
Task.taskID,
Task.versionNo
INTO
:taskID,
:versionNo
FROM
TaskAssignment,
Task
WHERE
TaskAssignment.relatedName = :relatedName
AND TaskAssignment.assigneeType = :assigneeType
AND TaskAssignment.taskID = Task.taskID
AND Task.reservedBy IS NULL
AND Task.assignedDateTime =
(
SELECT
MIN(assignedDateTime)
FROM
TaskAssignment,
Task
WHERE
TaskAssignment.relatedName = :relatedName
AND TaskAssignment.assigneeType = :assigneeType
AND TaskAssignment.taskID = Task.taskID
AND Task.assignedDateTime <= :assignedDateTime
AND Task.reservedBy IS NULL
)
|