--- Takanobu Kawabe <[EMAIL PROTECTED]> wrote:

> Is there any way to set  many columns of the table  in one line?
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
> http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 

The UPDATE command is not limited to acting on just one column at a
time or (depending on your version) one table at a time.

An example single-table, multi-column update:

UPDATE user_account SET lastname='Jones', married='Y' WHERE ID = 16;

An example multi-table, multi-column update:

UPDATE old_table o
INNER JOIN bulk_changes b
  ON o.pkid = b.pkid
SET o.Col_1 = b.Col_1, o.Col_2 = b.Col_2, o.Col_3 = b.Col_3,
o.updatetime = CURDATE();

Details are here:
http://dev.mysql.com/doc/refman/4.1/en/update.html

I hope that helps,
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

Reply via email to