Wednesday, July 18, 2012

MySQL Locate Last Occurrence of Space in Field

You'd think the mighty MySQL would come with its own function to do this but it doesn't. So I do it like this:

length(`my_field `)-locate(' ',reverse(`my_field`))+1


No comments:

Post a Comment