SELECT
activityID,
userName,
organisationID,
subject,
activityTypeCode,
startDateTime,
endDateTime,
allDayInd,
locationID,
locationName,
priorityCode,
timeStatusCode,
notes,
recurrenceID,
caseID,
concernRoleID,
recordStatusCode
INTO
:activityID,
:userName,
:organisationID,
:subject,
:activityTypeCode,
:startDateTime,
:endDateTime,
:allDayInd,
:locationID,
:locationName,
:priorityCode,
:timeStatusCode,
:notes,
:recurrenceID,
:caseID,
:concernRoleID,
:recordStatusCode
FROM
Activity
WHERE
(
activityID in
(
SELECT
activityID
FROM
ActivityAttendee
WHERE concernRoleID = :concernRoleID
AND recordStatusCode = :recordStatusCode
AND
(
(
:acceptedInd IS NULL
)
OR
(
acceptedInd = :acceptedInd
)
)
)
)
AND startDateTime <= :endDateTime
AND endDateTime >= :startDateTime
AND
(
(
:activityTypeCode IS NULL
)
OR
(
activityTypeCode = :activityTypeCode
)
)
AND recordStatusCode = :recordStatusCode
|