• It would be very helpfull if you can give us some sample data and the desired result.

    See this link on how to post sample data: http://www.sqlservercentral.com/articles/Best+Practices/61537/

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **