What would be the simplest way to locate the index of the third space in a string.
My goal is to get CCC out of this space separated list: AAAA BB
CCC
AAAA BB
Generally you can select the nth word in a string using:
nth
SET @N = 3; -- 3rd word SET @delimiter = ' '; SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(words, @delimiter, @N), @delimiter, -1) FROM my_table