This should be simple, but I’m getting lost in the detail….
In a database field, if the string contains a the word ‘century’, I would like the previous word, e.g. ’16th’
I’ve been trying using the LOCATE and REVERSE functions, but cant make it work. Can anyone help?
Thank you!
You could try:
Use substring_index to return the string before ‘century’.
Use reverse to reverse the string.
Use substring_index to return the string before the first space (might need to trim it?).
Use reverse to reverse the string again.