Eko Budiharto <[EMAIL PROTECTED]> wrote on 03/18/2005 11:54:09 AM:

> 
> Hi,
> I am trying to to update one field with multiple value. 
> I tried with regulare "update" command syntax does not work. How to 
> update a field with multiple value.
> 
> regular update syntax is this, UPDATE variableInfo SET variable='A' 
> WHERE variable is null;
> 
> but what I want to do is UPDATE variableInfo SET variable='A, B' 
> WHERE variable is null;
> 
> when I use that command, mysql does not understand the syntax. How 
> to update a field with multiple value or with an array?
> 
> +-------------+
> + variable +
> +-------------+
> +             +
> +             + 
> +-------------+
> 
> but I want to update this column into 
> +-------------+
> + variable +
> +-------------+
> +             +
> +   A, B   + 
> +-------------+
> 
> 
> thank you in advance.
> 

Assuming that your column is declared as a SET datatype (as that is the 
only multivalue type MySql supports), you would update that column with 
the command you gave EXCEPT you would remove the space between the comma 
and B.

UPDATE variableinfo set variable ='A,B' WHERE variable is null;

See: http://dev.mysql.com/doc/mysql/en/set.html
for more examples.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to