MySQL Forums
Forum List  »  Newbie

Insert String Pulled from Another Field?
Posted by: Dan LeGate
Date: May 08, 2022 08:35PM

Okay, I'm sure this has been asked/answered, but I couldn't seem to find the right keywords to find what I'm looking for.

I have two database fields (among others) in the same table. The first has a longer string (varchar) separated by hypens:

1223-ABC-543-01-1

and another field with a number stored as a varchar:

0256

and I want to update the first field to INSERT the value in the second field just after the last hyphen, and add a new hyphen, so the updated first field will look like this:

1223-ABC-543-01-0256-1

The update shouldn't touch/update any other fields in the table. The table does have an auto-increment primary INT key field as well, if that helps/makes a difference.

Any advice is appreciated!

Options: ReplyQuote


Subject
Written By
Posted
Insert String Pulled from Another Field?
May 08, 2022 08:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.