I am trying to create a an encryption in MySQL. Lets say there is a string of characters.
"I can run for as many".
I want to replace each letter with its fourth letter. For example,
'a' replaced with 'e'
'b' replaced with 'f'
and so on.
The Final output of the above would look something like this. "M gen vyr jsr ew qerc"
The best I could come up is the below. Since it is a nested function, it is not giving me the right result. The below function replaces 'a' with 'e' and then again replaces 'e' with 'i' until it reaches the end.
select messagetext,
replace(replace(replace(replace(replace(replace(replace(replace
(replace(replace(replace(replace(replace(replace(replace
(replace(replace(replace(replace(replace(replace(replace
(replace(replace(replace(replace(messagetext,'a','e'),
'b','f'),'c','g'),'d','h'),'e','i'),'f','j'),'g','k'),
'h','l'),'i','m'),'j','n'),'k','o'),'l','p'),'m','q'),
'n','r'),'o','s'),'p','t'),'q','u'),'r','v'),'s','w'),
't','x'),'u','y'),'v','z'),'w','a'),'x','b'),'y','c'),
'z','d')
from chat;
Any help would be much appreciated.