• If you provide your table structure, some sample data and your expected results, I could help you better.

    See some guidance on providing this kind of thing here:

    http://www.sqlservercentral.com/articles/Best+Practices/61537/