Doug
Doug

Reputation: 49

MySql - How to return only part of a field - remove a certain word if exist in field

I have a field that contains a variety of text values that occasionally have a consistent string appended to the end of the field.

Example field values: Part One Part Two - New Part Three - New Part Four

I need to query that field but strip off the "- New" from the result.

What I need returned: Part One Part Two Part Three Part Four

Upvotes: 0

Views: 26

Answers (1)

Gaurav Singh Faujdar
Gaurav Singh Faujdar

Reputation: 1662

are you looking for something like select replace('Part One Part Two - New Part Three - New Part Four', '- New','');

Upvotes: 1

Related Questions