joined:Mar 4, 2004
Is this possible? How do I get the placeholder \\1 into the select statement to get the value out of the other table?
UPDATE phpbb_posts SET post_text = REGEXP_REPLACE
CONCAT('https://example.com/forum/viewtopic.php?f=' , (SELECT `forum_id` FROM phpbb_topics WHERE `topic_id` = '\\1') , '&t=\\1')
This is a one off query but I have a few other similar ones to perform. I could write a script but this would make life a lot easier now and down the road for similar queries. The problematic part is this.
(SELECT `forum_id` FROM phpbb_topics WHERE `topic_id` = '\\1')
I'm getting 0 results presumably because it's not using the placeholder value. If I change \\1 to an actual topic ID number it works fine but of course that doesn't give me the topic ID's i need.