End result: all 3 fields should be merged (solved OK), and the character “T” should be added as the 5th character in the merged string (no other characters should be removed or altered in sequence). (see all specifics below).
What am I doing wrong?
Data is in the following format:
data1: AL
data2: 33 0230S 0440E
data3: SW
Here is my current sql:
replace(concat(b.data1,
substr(b.data2, 4, 1),
'T',
substr(b.data2, 1),
b.data3), ' ', '')
AS MergedData
The final output should look like:
AL33T0230S0440ESW
I’ve been able to get the “T” placed at random locations, but cannot get it consistently added as the 5th character from the start of the string.
Use:
T(Don’t use substr at all)
Here’s a test:
Output: