The problem is that you're setting all the rows to "%".  The % symbol is only 
recognized as a wildcard in like expressions, as documented in the manual.  Try this 
instead:

UPDATE words_bak1 SET word = LEFT(word, LENGTH(word) - 1) WHERE word LIKE "%s";
 
Steve Meyers


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, October 20, 2001 4:49 PM
> To: [EMAIL PROTECTED]
> Subject: UPDATE problem
> 
> 
> 
> Hi,
> 
>   I am encountering a problem while I am updating records of a table.
> Basically its a problem of updation of records using pattern matching.
> I want all the recods that end with letter "s" be updated to record
> without the letter "s" at the end. For eg, I want a record "things"
> to be converted to "thing".
> 
>   When I give a query like this I get an error :
> 
>   mysql> UPDATE words_bak1 SET word = "%" WHERE word LIKE "%s";
> ERROR 1062: Duplicate entry '%' for key 1
> 
> my words_bak1 is like this :
> +------------+----------+------+-----+---------+----------------+
> | Field      | Type     | Null| Key | Default | Extra |
> +------------+----------+------+-----+---------+----------------+
> | wordid     | int(11)  |     | PRI | 0       | auto_increment |
> | word       | char(20) |     | UNI | |       |                |
> | actualword | char(20) | YES |     | NULL    |                |
> +------------+----------+------+-----+---------+----------------+
> 
>   Can someone tell me what the problem is and is there some way
> to get around it..
> 
> -Amit
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to