• Believe what you may be looking for is the MERGE statement. For a discussion and example of how it works:

    http://www.simple-talk.com/sql/learn-sql-server/the-merge-statement-in-sql-server-2008/

    If you would/could post the table definition, some sample data and desired result someone may be able to assist you with tested sample T-SQL.

    To provide the sample as I suggested please click on the first link in my signature block and read the article. The article has sample T-SQL to allow you to post the table definition, some sample data and desired result simply and easily.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]