Well, nobody can help with this limited amount of information
Please describe your issue and give us some sample data and the expected results as per your sample data
It would be really good if you can provide this in a readily usable format
If you are not sure on how to do this, reading the link in my signature would give you a good idea
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/