• Hey,

    I finally had 5 minutes to read through your replies here and have realised that you've completely changed the requirements. So, what we need from you is sample data and expected results based on your sample data. From there, I'm sure it'll be a fairly trivial task but right now you've got people shooting in the dark which is why no-one else has given you a ready made answer.

    Thanks!


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/