5

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.

1 Answer 1

12

You can use substring_index

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

DEMO

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.