pallab sen
pallab sen

Reputation: 51

Find the string after a specific substring in mysql

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

Answers (1)

M Khalid Junaid
M Khalid Junaid

Reputation: 64476

You can use substring_index

select
substring_index(title,'capitalof',-1)
from table1

DEMO

Upvotes: 12

Related Questions