Jason-299789 (1/3/2013)
Ok, I didnt realise there was any other logic.This is a way to do it with a Left Join
Select t2.*
from #temp2 t2
Left Join #temp1 t1 on t2.StudentLocalID=t1.StudentLocalID and t2.ScheduleSchoolCode=t1.EnrollSchoolCode
where
t1.EnrollSchoolCode is Null
Heres a way with a Not Exists
Select t2.*
from #temp2 t2
Where
NOT EXISTS (Select 1 from #temp1 t1
Where t1.EnrollSchoolCode=t2.ScheduleSchoolCode
and t1.StudentLocalID=t2.StudentLocalID)
Either should enable you to add more logic.
Thank You so Much This works
Awesome