Query modification help

HI, Can anyone tell me how to modify the following query to show only the NumberAttended since October 9, 2019? I am trying to find out how many times people in this group have attended since October 9. (I keep getting total times they have attended ever. )

                  P.person_id, P.nick_name, P.last_name, COUNT(core_occurrence_attendance.person_id) AS NumberAttended, smgp_group.group_name,
                  MAX(core_occurrence.occurrence_start_time) AS DateLastAttended, smgp_group.active, smgp_group.group_id
FROM     smgp_group_occurrence INNER JOIN
                  smgp_group ON smgp_group_occurrence.group_id = smgp_group.group_id INNER JOIN
                  core_occurrence ON smgp_group_occurrence.occurrence_id = core_occurrence.occurrence_id INNER JOIN
                  core_person AS P INNER JOIN
                  core_occurrence_attendance ON P.person_id = core_occurrence_attendance.person_id ON
                  smgp_group_occurrence.occurrence_id = core_occurrence_attendance.occurrence_id LEFT OUTER JOIN
                  smgp_v_group_member_role AS GMR ON smgp_group.group_id = GMR.group_id AND GMR.person_id = P.person_id LEFT OUTER JOIN
                  core_lookup AS tb_member_status ON P.member_status = tb_member_status.lookup_id
GROUP BY P.person_id, P.nick_name, P.last_name, P.birth_date, dbo.fn_Age(P.birth_date, GETDATE()), tb_member_status.lookup_value, P.record_status, smgp_group.group_name,
                  smgp_group.active, smgp_group.group_id, P.member_status
HAVING (smgp_group.group_id IN (185)) AND (MAX(core_occurrence.occurrence_start_time) >= GETDATE() - 14)
ORDER BY P.last_name

Parents Reply Children
No Data
More Content