Reputation: 51
I want to retrieve the last part of a large string in mysql after occurence of a particular substring. Please advice about how to do that.
For e.g. the main string contains "New Delhi is capitalof India". "Berlin is capitalof Germany".
I need to retrieve only India and Germany. I want know how to retrieve the data occuring after the specific substring like 'capitalof'.
I need to do this in mysql.
Upvotes: 5
Views: 10424
Reputation: 64476
You can use substring_index
select
substring_index(title,'capitalof',-1)
from table1
Upvotes: 12