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 8214089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:20:32+00:00 2026-06-07T11:20:32+00:00

I have one table, and I need to remove a specific text from a

  • 0

I have one table, and I need to remove a specific text from a specific field. This field contains a full URL of an image, I need to remove the URL and just keep the image filename.

So:
Current date: fieldname: http://www.example.com/photo.jpg
What I want to do is remove http://www.example.com/ from all of the entries for this field.

I know how to use the search and replace function, but I don’t know how to leave part of the data intact.

This is what I’ve used but can’t modify it to make it work the way I want:

UPDATE table SET oc_upload1 = REPLACE(oc_upload1,'newtext') WHERE oc_upload1 LIKE "oldtext"

Is this possible? If so, how? Thank you!

  • 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-07T11:20:33+00:00Added an answer on June 7, 2026 at 11:20 am

    This should do:

    UPDATE table
    SET image = REPLACE(image, 'www.example.com/','')
    

    but, it’s possible that image contains ‘www.example.com/’ as part of image file name so to be extra safe and replace only the first occurence of http://www.example.com

    UPDATE table
    SET image = SUBSTRING(image, LENGTH('www.example.com/') + 1)
    WHERE image LIKE 'www.example.com/%'
    

    But if You really, really just want the file name and not path to the file You can also use:

    UPDATE table
    SET image = SUBSTRING_INDEX(image,'/',-1)
    

    Note that above statement will change ‘www.example.com/images/01/02/daisy.jpg’ to ‘daisy.jpg’, not ‘images/01/02/daisy.jpg’. It also wont change rows that does not contain ‘/’ in image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one table TABLE_EXAM . i need to update the value of specific
I need to copy a table from one server to another.for that I have
I have one table TABLE_QUESTION. I need to fetch record by passing exam_id and
I have one table TABLE_SUBJECT which contain a number of subjects. I need to
I have a one table question_table and one ImageButton ( Back ). I need
i have day, month, year, value columns in one table, here i need to
I need to have MySQL query like this one: UPDATE table_name SET 1 =
I have one table which contains events and dates, and another which contains the
I have one jQuery code and need some help from u guys to improve
I have a situation where I want to associate multiple values from one table

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.