• Thank you for providing me the link.

    I have updated the post with more detail with respect to Tables definition, execution plan etc., The RCC_Id in #tblRCCCommanMOGEValues is not Unique and there will 2 rows for each Rcc_id in the table #tblRCCCommanMOGEValues. One row will have 0 for its cc_group column and another will have 1 for the cc_group column.

    Please let me know if you require any more details.