• Actually I didnt see the outer query and was just focused on correcting Case statement...

    I read query and see that case can return multiple values and this can lead to incorrect result......... :ermm:

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/