• The original request was that if both of the values are 99, then we have to exclude that line. It is enough that one of the columns won't be 99. The original poster did not specify what to do if both of the values don't equal 99, but from his desired results you can see that he wouldn't want to exclude them (see the third row in the expected results). In that case if one of the columns is different then 99 or both of them are different then 99, they should be included in the resultset. I think that the criteria WHERE cCurrentGradeCode <> '99' or cAnticipatedGradeCode <> '99' does the job.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/