Look around for a "how to post" article so you can learn how to help us help you. Can you give us a sample table(s), sample data, sample code you are trying and what you expect to happen with the data?
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service