I guess I can replace it with a null string..

select REPLACE('foo', 'foo', '');

Works just fine!
Thanx!


Well, then my SET problems is fixed.

I wanted a way to add, replace or remove elements in a set without doing
it with any extra code.

fyi then, this could come handy.

To:

Add an element in a set:
update table_name set setfield = CONCAT(setfield, ',newelement');

Remove an element from a set:
update table_name set setfield = REPLACE(setfield, 'oldelement', '');

Change a element in a set:
update table_name set setfield = REPLACE(setfield, 'oldelement', 'newelement');




Regards
/ Paul






On Thu, 18 Jan 2001, Basil Hussain wrote:

> Hi,
>
> >> This works:
> >>
> >> mysql> select trim('foo' FROM 'foobaar');
> >> +----------------------------+
> >> | trim('foo' FROM 'foobaar') |
> >> +----------------------------+
> >> | baar                       |
> >> +----------------------------+
> >> 1 row in set (0.00 sec)
> >>
> >> This does not work: !
> >>
> >> mysql> select trim('foo' FROM 'foo');
> >> +------------------------+
> >> | trim('foo' FROM 'foo') |
> >> +------------------------+
> >> | foo                    |
> >> +------------------------+
> >> 1 row in set (0.00 sec)
>
> If all you want to do is remove any occurance of 'foo' in a string or column
> value then I'd recommend you look at the REPLACE() function in the manual.
>
> Regards,
>
> ------------------------------------------------
> Basil Hussain ([EMAIL PROTECTED])
>
>
> ---------------------------------------------------------------------
> 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
>

-- 



                   \\\___///
                  \\  - -  //
                   (  @ @  )
 +---------------oOOo-(_)-oOOo-------------+
 |        Paul Wisén   [EMAIL PROTECTED]      |
 |               WWW.BUSNET.SE             |
 |    Ett smartare sätt att boka buss      |
 |      Tel:026-669470   GSM:070-5164100   |
 +------------------------Oooo-------------+
                  oooO   (   )
                 (   )    ) /
                  \ (    (_/
                   \_)



---------------------------------------------------------------------
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