I am working on a project where I have the two below tables:
#temp1:
#temp2:
So for every client on #temp2 table, I have to check if the substring(outcome,1,12) matches with text1/text2/text3/text4 of #temp1 table. And if they match the then concatenate text1/text2/text3/text4(replace the matching substring on #temp1 with outcome of #temp2). The final output is to be as below:
#output desired:
So for CID 1001, the substring(#temp2.outcome,1,12) = SOP201800205 matches with #temp1.text2 = SOP201800205. So my output should be
Concat(#temp1.text1,#temp2.outcome)
My trial here in rextester demo:
https://rextester.com/CAEP69354
Any help?!


