affiliate sql optimization set isfaculty = 0