On 19-Jul-2001 Nick Brandon wrote:
> Hi
> 
> I have been searching through the manual and the list archives for the last
> few days regarding a problem I have with the SET column type.
> 
> I'm creating an app that uses a SET column as 'flags'. Different parts
> within the application will check to see if certain 'flags' are enabled. As
> I understand, the SET column uses bit representation internally.
> 
> My problem is updating the column with flags already set. Below is an
> example:
> 
> The table is as follows:
> 
> CREATE TABLE users ...
>       user_id INT ...
>       user_flags SET('another','test','pass_renew','none') NOT NULL DEFAULT
> 'none'
>       ...
> 
> When I update a record, I can only set the whole string not just the
> individual flag.
> 
> i.e. This works fine...
> 
> UPDATE users SET user_flags = 'test, none' WHERE user_id = 1
> 
> How can I add (or remove) values within the SET column without affecting the
> existing contents?
> 
> I've tried a number of ways with no success!!
> For example
> 
> UPDATE users SET user_flags = CONCAT(user_flags,'pass_renew') WHERE user_id
> = 1
> 
> Any help or pointers would be greatly appreciated.
> 

So close!

UPDATE users SET user_flags = CONCAT(user_flags,', pass_renew') ...
                                                 ^
Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)

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