MySQL Forums
Forum List  »  General

NEED HELP WITH WILD CARD INSIDE REPLACE statement.
Posted by: sandy aaaa
Date: March 07, 2018 10:47AM

Hi MYSQL experts

current data in table. COLUMN NAME IS URL
*******************
/abc1/pqr
/abc10/pqr

i need below result ie abc1 and abc10 should be replaced to xyz
*******************
/xyz/pqr
/xyz/pqr

HOW CAN I DO THIS USING REPLACE COMMAND AS I AM UNABLE TO USE WILD CARD INSIDE REPLACE statement ????
CURRENTLY I AM USING BELOW 2 STATEMENTS BUT I NEED A SINGLE STATEMENT....
*******************
UPDATE TABLE_URL
SET url = REPLACE(url, '/abc1/pqr', '/xyz/pqr')

UPDATE TABLE_URL
SET url = REPLACE(url, '/abc10/pqr', '/xyz/pqr')
*****************

Options: ReplyQuote


Subject
Written By
Posted
NEED HELP WITH WILD CARD INSIDE REPLACE statement.
March 07, 2018 10:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.