Jump to content

don't understand the logic


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?


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...