Saiph,

You can use REPLACE command instead of UPDATE. This command will update all
rows with the same primary key.

Laercio. 

-----Original Message-----
From: Michael Kruckenberg [mailto:[EMAIL PROTECTED] 
Sent: segunda-feira, 31 de maio de 2004 18:33
To: saiph
Cc: [EMAIL PROTECTED]
Subject: Re: update synopsis error

What version of MySQL are you using? Subqueries aren't available until
4.1.x.

saiph wrote:

> 
> hi,
> 
> 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?

--
http://mike.kruckenberg.com | [EMAIL PROTECTED]


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


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

Reply via email to