[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi-table update


Corey Kaye writes:
> I'm wondering what is the best way to update one table based on another.  Can joins be performed for an update?
> 
> update table1 set table1.field2 = table2.field2 where table1.field1 = table2.field1;
> 
> The alternative seams to be:
> select table2.field2 from table2;
> update table2 set table2.field2 = $savedValue;
> 
> which is very slow....
> 
> Thanks.
> 

This feature will come in 4.0.2, with a different syntax:

UPDATE join_table_list SET ... WHERE ...

-- 
Regards,
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Sinisa Milivojevic <sinisa@xxxxxxxxx>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Fulltime Developer
/_/  /_/\_, /___/\___\_\___/   Larnaca, Cyprus
       <___/   www.mysql.com


---------------------------------------------------------------------
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 <mysql-thread92893@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.