• It will be helpful if you attach also sample data, expected result and the version of SQL Server that you are using.