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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:51:18+00:00 2026-06-06T19:51:18+00:00

I need to do the following and I’m struggling with the syntax: I have

  • 0

I need to do the following and I’m struggling with the syntax:

I have a table called ‘mytable’ and a column called ‘mycolumn’ (string).

In mycolumn the value is a constructed value – for example, one of the values is: ‘first:10:second:18:third:31’. The values in mycolumn are all using the same pattern, just the ids/numbers are different.

I need to change the value of 18 (in this particular case) to a value from another tables key. The end result for this column value should be ‘first:10:second:22:third:31’ because I replaced 18 with 22. I got the 22 from another table using the 18 as a lookup value.

So ideally I would have the following:

UPDATE mytable 
SET mycolumn = [some regex function to find the number between 'second:' and ":third" - 
let's call that oldkey - and replace it with other id from another table - 
(select otherid from tableb where id = oldkey)].

I know the mysql has a REPLACE function but that doesn’t get me far enough.

  • 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-06T19:51:20+00:00Added an answer on June 6, 2026 at 7:51 pm

    You can create your own function. I am scared of REGEX so I use SUBSTRING and SUBSTRING_INDEX.

    CREATE FUNCTION SPLIT_STRING(str VARCHAR(255), delim VARCHAR(12), pos INT)
    RETURNS VARCHAR(255)
    RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(str, delim, pos),
       LENGTH(SUBSTRING_INDEX(str, delim, pos-1)) + 1),
       delim, '');
    
    SPLIT_STRING('first:10:second:18:third:31', ':', 4)
    

    returns 18

    Based on this answer:

    Equivalent of explode() to work with strings in MySQL

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

Sidebar

Related Questions

Well, i have the following need: create 3 dropdownlist with dependencies. My table in
I need the following logic. If array contains value , return it else return
OK, I'm probably just having a bad Monday, but I have the following need
we have following table (output is already ordered and separated for understanding): | PK
Lets say I have the following table in MS SQL 2000 Id | description
--I have a Table named CLASS with the Following Records in it (PK) ClassID
I have following table ID | Group | Type | Product 1 Dairy Milk
I have following data in a mysql table, +------------+--------+--------+ | date | inQty |
I have the following need: I want to call a js each time an
I have the following need (in python): generate all possible tuples of length 12

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.