update a field with multiple value

2005-03-18 Thread Eko Budiharto

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.




-
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 

Re: update a field with multiple value

2005-03-18 Thread Alec . Cawley
Eko Budiharto [EMAIL PROTECTED] wrote on 18/03/2005 16:54:09:

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

MySQL does not support arrays of data in one field. You cannot enter 
multiple entries into a numeric field. You could, of course, enter it as a 
string, but this is regarded as very bad practice. Most users would 
inquire why you need to do this, and suggest that you should be 
reconsidering your table design if you need this sort of facility.

Alec

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: update a field with multiple value

2005-03-18 Thread SGreen
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



Re: update a field with multiple value

2005-03-18 Thread Gleb Paharenko
Hello.



 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?



Multiple values could hold the SET columns, But I think that

this is not exactly what you want. See:

  http://dev.mysql.com/doc/mysql/en/set.html





Does MySQL server produce an error on your update statement? The syntax

looks correct.













Eko Budiharto [EMAIL PROTECTED] wrote:

 [-- text/plain, encoding 7bit, charset: us-ascii, 35 lines --]

 

 

 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.

 

 

 



 -

 Do you Yahoo!?

 Yahoo! Small Business - Try our new resources site! 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   ___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]