List:General Discussion« Previous MessageNext Message »
From:David Lerer Date:March 9 2012 9:46pm
Subject:RE: preg_replace in update statement
View as plain text  
Try with a combination of functions LOCATE and SUBSTR.
Locate will return the positions for WordA and WordB within the original text, and, SUBSTR
will allow you to string what you you need all together.

On Thu, Mar 8, 2012 at 4:11 PM, Hank <heskin@stripped> wrote:
> I have a simple problem:
> I have a varchar field in the database, and I want to remove all text
> between WordA and WordB, including WordA and WordB, leaving all text
> before WordA and after WordB intact.
> Possible with just SQL?  I know I can write a PHP program to do it,
> but it's not that important to spend that much time on.  I'd like one
> SQL statement to do it.
> Thanks!
> -Hank
> --
> MySQL General Mailing List
> For list archives:
> To unsubscribe:

Baron Schwartz
Percona Inc <>
Consulting, Training, Support & Services for MySQL

MySQL General Mailing List
For list archives:
To unsubscribe:

The information contained in this e-mail and any attached 
documents may be privileged, confidential and protected from 
disclosure.  If you are not the intended recipient you may not 
read, copy, distribute or use this information.  If you have 
received this communication in error, please notify the sender 
immediately by replying to this message and then delete it 
from your system.
preg_replace in update statementHank8 Mar
  • Re: preg_replace in update statementBaron Schwartz9 Mar
    • RE: preg_replace in update statementDavid Lerer9 Mar
  • Re: preg_replace in update statementhsv10 Mar
Re: preg_replace in update statementHank9 Mar