SELECT
    E.event_time AS eventTime,
    E.event_time_zone AS eventTimezone,
    E.event_type AS eventType,
    E.shift_start AS shiftStart,
    P.system_id AS personSystemId,
    T.system_id AS taskSystemId
FROM
    user_group_membership UGM
        INNER JOIN
    person P ON
            UGM.member = P.person_id
        INNER join
    eventlog E ON
            P.person_id = E.person_id
        LEFT JOIN
    task T ON
            E.task_id = T.task_id
WHERE
        UGM.assigned_group_id = :usergroupparam
  AND P.customer_id = :customerparam
  AND E.modified_at > :updateafterparam
  AND E.modified_at < :updatebeforeparam
  AND E.is_deleted = 1
  AND (E.event_type = 0
    OR E.event_type = 1)