Wouldn't that would also change "theater" to "anaater"? You need the
hyphens:

mysql> SELECT REPLACE("theater", "the-", "an-");
+-----------------------------------+
| REPLACE("theater", "the-", "an-") |
+-----------------------------------+
| theater                           |
+-----------------------------------+
1 row in set (0.06 sec)

mysql> SELECT REPLACE("the-theater", "the-", "an-");
+---------------------------------------+
| REPLACE("the-theater", "the-", "an-") |
+---------------------------------------+
| an-theater                            |
+---------------------------------------+
1 row in set (0.03 sec)

You will also have problems if there are capitalization differences.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341


> -----Original Message-----
> From: spacemarc [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 17, 2006 9:27 AM
> To: Mike Kruckenberg
> Cc: mysql@lists.mysql.com
> Subject: Re: Update query in order to modify some fields
>
> 2006/11/17, Mike Kruckenberg <[EMAIL PROTECTED]>:
> > If it's values you are updating you can use the replace() string
> > function to do something like this:
> >
> > update table1 set field1=replace(field1,'the','an');
> >
> > To demonstrate:
> >
> > mysql> select replace("the-object1","the","an");
> > +-----------------------------------+
> > | replace("the-object1","the","an") |
> > +-----------------------------------+
> > | an-object1                        |
> > +-----------------------------------+
> > 1 row in set (0.09 sec)
> >
>
> ok.
> I will use the replace function in Update query.
>
>
> --
> http://www.spacemarc.it
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>
>




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to