Reputation: 598
I have an address field in which I only want to extract only the city and the state. The data is stored as such: (1234 Cherry ST_Sometown_ST). I would like to removed everything up to and including the first underscore. Is there an easy way to do this with REGEXP_REPLACE()
or another similar function?
The only think I have found so far is the ability to remove an Nth number.
Upvotes: 1
Views: 202
Reputation: 7847
Try this
select substr(address, instr(address, '_') + 1, length(address)) as "CityState"
from address
Upvotes: 3