Jump to content

don't understand the logic


mikev1976

Recommended Posts

This is my query: select EligibilityFirstName,EligibilityLastName,EligibilityDateOfBirth,ExternalUserId, u.NameFirst,u.NameLast,DateOfBirthfrom Member.Users as ujoin Outreach_Core.CallAppointments as ca on u.UserId=ca.CalleeIdwhere 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 cwhere 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?

post-86339-0-09151600-1330019101_thumb.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...