saiph <[EMAIL PROTECTED]> wrote: > > mysql> update table1 > set c = (select c2 from table2 where c2 = 'value') > where id = 123; > > give me an ERROR 1064. > > > i.e. > > create table t1 ( id int primary key, name varchar(20) ); > create table t2 ( id int primary key, name varchar(20) ); > > insert into t1 values(1, 'not right') > insert into t2 values(1, 'right') > > update t1 set name = (select name from t2 where id = 1) where id = 1; > > how i can update right? >
Subqueries are supported since 4.1.0. If you use 4.0.x you can update t1 with the following statement: UPDATE t1, t2 SET t1.name=t2.name WHERE t1.id=1 AND t2.id=1; If you use version 3.23.xx you can't do it with one query. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [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]