MySQL Hide Specific Characters from Query

Posted on 2011-10-13
Last Modified: 2012-05-12
I'm trying to run a query that returns a VARCHAR field that may or may not contain the characters ***. If it does contain that, I basically want to hide the 3 characters and display the rest of the string. I was trying to get the syntax below to work, but for some reason it doesn't. Any help please? Thanks!

SELECT Field1 = REPLACE(Field1,'***','') AS Test FROM `tbl_Data` WHERE ID=33

Open in new window

Question by:brendan-amex
    LVL 15

    Accepted Solution

    Is this specific query the issue, because if it is, the "Field1 =" part is probably your problem. Try:
    SELECT REPLACE(Field1,'***','') AS Test FROM `tbl_Data` WHERE ID=33

    Open in new window


    Author Closing Comment

    Oops, yep. That was it. Easy 500 points. Thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    This article describes some very basic things about SQL Server filegroups.
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    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…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now