select distinct cdr_recordId_backup, cdr_recordId_new, cdr_recordId_2_status from tbl_TBA_ClaimDetail with (nolock) where cdr_recordId_backup is not null and cdr_recordId_new is null order by cdr_recordId_backup select fsl_dstID, ownerid, fsl_TableCode from tbl_CDR_Distributors with (nolock) where cdr_recordId = select cdr_recordID from tbl_CDR_Distributors with (nolock) where ownerid = 1 and fsl_TableCode = 'MFR' and fsl_dstid = order by fsl_mapPriority asc update cd set cdr_recordid_new = , cdr_recordId_2_status = 'REMAPPED_4' from tbl_TBA_ClaimDetail cd inner join tbl_TBA_Claims c on cd.claimid = c.claimid where c.ownerid = 1 and c.fsl_TableCode = 'MFR' and cd.cdr_recordID_backup = and cd.cdr_recordid_new is null