How can I Trim (remove) all characters from the Right of a string upto the first space?
Here's what I'm trying to do:
set @s:='May the Gods watch over your battles, my friend!';
select if(length(@s) < 10,@s,left(@s,10)) a;
#output from above: 'May the Go'
#desired output: 'May the'
To avoid such odd outputs like May the Go
I'm trying to trim all characters from the right, upto the first space, so the output is May the
.
How can this be done in the sql statement itself. I could not find a built in function that'll do this?