This is a reply to the SET column UPDATE question (I deleted to e-mail, oups!).
The question was that you have a column of type SET and value ("a,b,c") and you want 
to make this ("a,b,c,d")
In the __MySQL MANUAL__ it says that the SET type is actually stored numerically and 
in particular "with the low-order bit of the stored value corresponding to the first 
set member" and a couple of lines further down "If a number is stored into a SET 
column, the bits that are set in the binary representation of the number determine the 
set members in the column value" 
i.e. if your set has values "a,b,c,d" then:
a = 0001
b = 0010
c = 0100
d = 1000

So if you do an update of the form:
UPDATE table SET set_var=3 WHERE my_cond;
it would actually make set_var=("a,b") for the tuple that my_cond holds since the 
ten_Base 3 is the binary 11.

So in your case that you want to add "d" to a tuple that is "a,b,c" you do 
UPDATE table SET set_val=15 WHERE my_cond;
since 15 is 1111 in binary (the leftmost '1' is the flag that tells mysql to add the 
"d" in your set)

does it make any sense?

regards,
thalis

-------------------------------+
You're definitely on their list. 
The correct question to ask is what list it is.
-----------------------------------------------+


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