• Dear Gurjer,

    Honestly, from the description of your problem I have no idea what you are trying to achieve. Please give us some DDL statements, i.e. how to create your tables, some test data in a readily consumable format, and then please tell us what you expect the query you are trying to write to do to the test data you supplied to arrive at the desired result. Because, honestly, from what you posted, I have not a clue.

    --------------------------------------------------------------------------
    A little knowledge is a dangerous thing (Alexander Pope)
    In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)[/url]