In our DB we have a name column and I am trying to select out first and last using but the data uses either | or space delimiters. Right now our code works for the space names but I need it to split on either one.
table.name
first last
first2|last2
select substr(upper(mid(vo.name, 1, locate(' ',vo.name)-1)),1,20) as 'First Name',
substr(upper(mid(vo.name, locate(' ',vo.name)+1, 100)),1,20) as 'Last Name'
from table vo
Is there a way to look for either one?
I ended up going with a nested replace() function to santize the data inline but I feel like there might be a cleaner way.