I am not really clear what your requirement is.
You can probably explain it much better with some DDL, sample data( may be some 10 - 20 rows ) and the expected results based on the sample data
If you are not sure about how to provide this, please refer the link in my signature for detailed information
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/