Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-27
4
Medium Priority
?
346 Views
Last Modified: 2012-05-12
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!
0
Comment
Question by:brendan-amex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 36713202
UPDATE SomeTable
SET SomeColumn = LEFT(SomeColumn, LEN(SomeColumn) - 3)
WHERE RIGHT(SomeColumn, 3) = "***"
0
 

Author Comment

by:brendan-amex
ID: 36713459
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
 

Accepted Solution

by:
brendan-amex earned 0 total points
ID: 36714099
nevermind, figured it out.

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

0
 

Author Closing Comment

by:brendan-amex
ID: 36899013
Found the answer myself online.

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question