Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:26:23+00:00 2026-06-13T03:26:23+00:00

The title might have been a bit confusing but I can clarify here. I’m

  • 0

The title might have been a bit confusing but I can clarify here.

I’m trying to use mysql’s LIKE to match a value that sometimes is surrounded by a : or sometimes it can be on one side, or sometimes neither. I know of the wildcard % but that will select everything, so I found the _ which would work but it ALWAYS select that single character, I want to only select that character if it is a : otherwise not.

Still confused? Here’s an example.

Say I got a column called ‘name’ in the table ‘que’ and in the column ‘name’ I got a value of ‘sdfgsdfgsdfg:jimmy:asfds’ I want to select ‘:jimmy:’ but if instead the value was ‘sdfgsdfgsdfg:jimmy’ I want to select ‘:jimmy’ only.

Another example.

To acomplish this with regular expressions it would be like this (:?)jimmy(:?) if that helps.

Whats the purpose?

I want to remove jimmy from that value and replace it with a :
I’m trying to store Multiple name into one column and need to remove that one person.

I got something like this so far:

 UPDATE `que` SET `name`= CASE WHEN `name` LIKE '%jimmy%' THEN replace(`name`, '%jimmy%', ':') ELSE `name` end WHERE 1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:26:24+00:00Added an answer on June 13, 2026 at 3:26 am

    To acomplish this with regular expressions it would be like this (:?)jimmy(:?) if that helps.

    So use REGEXP?

    I’m trying to store Multiple name into one column and need to remove that one person.

    Don’t do that. Use your RDBMS’s relational capabilities and normalise your schema:

    CREATE TABLE que_names (
      que_id BIGINT UNSIGNED NOT NULL,
      name   VARCHAR(255)    NOT NULL,
      FOREIGN KEY (que_id) REFERENCES que (que_id)
    );
    
    INSERT INTO que_names
      (que_id, name)
    VALUES
      (1, 'bob'),
      (1, 'fred'),
      (1, 'james'),
      (2, 'michael'),
      (2, 'jimmy'),
      (2, 'fred')
      -- etc.
    ;
    
    ALTER TABLE que DROP COLUMN name;
    

    You would then remove all jimmy with:

    DELETE FROM que_names WHERE name = 'jimmy';
    

    If so desired, you could then retrieve your existing table as follows:

    SELECT   que.*, GROUP_CONCAT(que_names.name SEPARATOR ':') AS name
    FROM     que LEFT JOIN que_names USING (que_id)
    GROUP BY que_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the title might be a little bit confusing, let me explain, ;) I have
I might have written a pretty confusing title but my question is rather simple.
I asked a question , title of which might have been misleading so I'm
Sorry if this has been asked elsewhere. I have looked but can't find any
The title might not explain my problem fully but I wasn't sure how to
Does that title sound confusing? I thought it might well anyways. When I person
Apologies for the long winded title but looking for a solution to what might
Here's the fiddle: http://jsfiddle.net/scZtb/1/ Be warned, as the title suggests, this might crash your
recently I have been trying my hand at coding a game in C#. I'm
So I have been working with Wordpress 3.x and trying to build a custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.