select EligibilityFirstName,EligibilityLastName,EligibilityDateOfBirth,ExternalUserId, u.NameFirst,u.NameLast,DateOfBirth
from Member.Users as u
join Outreach_Core.CallAppointments as ca on u.UserId=ca.CalleeId
where u.SponsorId='AC475310-87AC-471B-90F6-9F5600B3AD3B'
and exists
--check to see if call was made in the last week
(select CallDate from Outreach_Core.Calls as c where c.CallDate >= @startDate and c.CallDate < @endDate and ca.callappointmentid=c.CallAppointmentId)
and(
exists
(select * from Outreach_Core.Calls as c
where ca.callappointmentid=c.CALLAPPOINTMENTID and c.CallResultTypeId=4)
and ca.CallAppointmentStatusTypeId=3
)
order by u.NameLast
So in my result set I get person that has the attached call dates. The way I understand the query they should not show up. They meet the conditions inside of the second exists statement but that is joined by an and to filter the call dates. The call dates for this user do not match the call date filter so why are they showing up?
Attached File(s)
-
CallResults.PNG (4.88K)
Number of downloads: 4











