Remote last 3 asterisks (***) from MySQL Field

I'm trying to figure out how to write a query that will remove the last 3 asterisks from a VARCHAR field only if they exist. I can't find much on google, any help is appreciated! Thank you!
brendan-amexAsked:
Who is Participating?
 
brendan-amexConnect With a Mentor Author Commented:
nevermind, figured it out.

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);

0
 
Patrick MatthewsCommented:
UPDATE SomeTable
SET SomeColumn = LEFT(SomeColumn, LEN(SomeColumn) - 3)
WHERE RIGHT(SomeColumn, 3) = "***"
0
 
brendan-amexAuthor Commented:
I'm running this in MySQL (phpmyadmin to test before moving it into php) and it says "FUNCTION databasename.LEN does not exist" Is there another way to do this that will work on MySQL?
0
 
brendan-amexAuthor Commented:
Found the answer myself online.

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.