When the case statements are taken out the query works fine. What I am trying to do is compare the building, grade, and program between two tables. What the case statements is being used for is, if the student is in KA, KP, or KF the r.grade value should be KG. Or, if the student is in PA, PP, or PK the r.grade value needs to be PK, otherwise, the r.grade value is the original from the database.