Thanks Karel,
This worked almost out of the box, just needed to find out that 'len+1' has
to be replaced with the actual number and is not automatically set (like len
= length('CONSTANT%'). But the manual also explains this very well, I just
didn't think of substring.
Hannes
On 7/3/01 9:13 AM, "karel pitra" <[EMAIL PROTECTED]> wrote:
>
> len = strlen(CONSTANT);
>
> UPDATE my_table SET field=substring(field,len+1) WHERE field LIKE 'CONSTANT%'
>
>
>
> On Tue 3. July 2001 17:49, you wrote:
>> I want to update 160 records in a table. The field contains a variable
>> value and a constant prefex like
>>
>> 'constant: unique value for this record'
>>
>> Is there such an UPDATE statement that would update this field into
>>
>> 'unique value for this record'
>>
>> They way I would do it otherwise is using Perls regular expressions like
>>
>> (this is rather pseudocode just to make the point)
>>
>> $foo = 'constant: unique value for this record';
>> $foo =~ s/constant:(.+)//sg;
>> $bar = $1; #(and hopefully $1 would hold 'unique value for this record')
>>
>> UPDATE my_table
>> SET field = $bar
>> WHERE field = $foo;
>>
>> Any ideas? Help greatly appreciated.
>>
>> Hannes
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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