Hi,
I am trying to join two tables that have similar fields, but in slightly different formats. I was previously using something along the lines of
like '%*%' Then SUBSTRING(b.fieldname,CHARINDEX(b.fieldname,'*',1)+1,9)
However the format has now changed and I am struggling to put something together.
Table A
BD8K1 23161*35*201904231110*QULN
Table B
23161*35*1
However the number of characters in both could vary so cant use that.
Table A
BD8K1 242875*10*201904251015*NBB1
Table B
242875*10*113
Is there some code that could be written that's something like:
A – From the space use the value up to and including the 2nd * (BD8K1 is at the beginning of every value in table A so could potentially use from character 7)
B – Use the value up to and including the 2nd *
Any help would be very much appreciated.
Thanks
James