• We don't have any idea how your table structures look like and hence, it will be very difficult to assist you

    It would be really helpful if you provide the DDL of the tables involved along with some sample data and expected results

    If you have any doubts on how to do this, you can refer the link in my signature


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/