• First you got to help us so that we can help you.

    It would be great if you could post the DDL for the table and some sample data + desired output.

    See the first link in my signature on how to do this.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP