I'm trying to extract the state from the address fields. the format is this: street, ST where street is the name of the street and ST is the state initials from 2 letters. most of the time the following code works but there are instances where it returns the 2 letters starting with the second position.
code: select substr(column, locate(',','column')+2,2) from table
example where it doesn't work. Sturgis, MI . for this example it returns the string 'tu'
Any idea why is acting like this?