Database SQL Operation: TaskAssignment.searchTasksAssignedToOrgObjectNearestToDate
Description: | Returns the identifiers of the tasks assigned to the specified organization object on the date nearest to the specified date. |
Sterotype: | nsmulti |
SELECT
t.taskID,
t.versionNo
INTO
:taskID,
:versionNo
FROM
TaskAssignment ta,
Task t
WHERE ta.taskID = t.taskID
AND t.reservedBy IS NULL
AND ta.assigneeType = :assigneeType
AND
(
:relatedName IS NULL
OR ta.relatedName = :relatedName
)
AND
(
:searchByRelatedIDInd = '0'
OR ta.relatedID = :relatedID
)
AND t.assignedDateTime =
(
SELECT
MAX(assignedDateTime)
FROM
TaskAssignment ta,
Task t
WHERE ta.taskID = t.taskID
AND t.reservedBy IS NULL
AND ta.assigneeType = :assigneeType
AND
(
:relatedName IS NULL
OR ta.relatedName = :relatedName
)
AND
(
:searchByRelatedIDInd = '0'
OR ta.relatedID = :relatedID
)
AND t.assignedDateTime <= :assignedDateTime
)
|