List:General Discussion« Previous MessageNext Message »
From:Truong Tan Son Date:March 17 2006 1:13am
Subject:(SOLVED) Re: Error 1064: update .....select nested.
View as plain text  
Dear Sir,

All solutions is very good !

update TABLE1 a
INNER JOIN TABLE2 b
        on a.id = b.other_id
set a.FIELD1=b.FIELD2
WHERE a.column1='literal';

Or

update TABLE1 a, TABLE2 b set a.FIELD1=b.FIELD2
where column2='sales@stripped'
And column1 = 'sales@stripped'

Or

update TABLE1 a, TABLE2 b set a.FIELD1=b.FIELD2
where b.column2=a.column1
And column1 = 'sales@stripped'


Thanks you very much.


----- Original Message ----- 
From: <SGreen@stripped>
To: "Ing. Edwin Cruz" <ecruz@stripped>
Cc: <mysql@stripped>; "'Truong Tan Son'" <sontt@stripped>
Sent: Thursday, March 16, 2006 10:51 PM
Subject: RE: Error 1064: update .....select nested.


AAAUUUGGGHHH!!! You used the dreaded "comma separated list" !!!  ;-)

A more explicit way to write the same thing posted by Sr. Cruz...

update TABLE1 a
INNER JOIN TABLE2 b
        on a.id = b.other_id
set a.FIELD1=b.FIELD2
WHERE a.column1='literal';

Actually posting a real query (instead of a cleansed "column1"..."column2"
query) would have resulted in you getting better answers.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

"Ing. Edwin Cruz" <ecruz@stripped> wrote on 03/16/2006 10:24:05 AM:

> update TABLE1 a, TABLE2 b set a.FIELD1=b.FIELD2
> where column2='sales@stripped'
> And column1 = 'sales@stripped'
>
>
>
> Or:
>
>
> update TABLE1 a, TABLE2 b set a.FIELD1=b.FIELD2
> where b.column2=a.column1
> And column1 = 'sales@stripped'
>
>
> Regards!
>
> -----Mensaje original-----
> De: Truong Tan Son [mailto:sontt@stripped]
> Enviado el: Miércoles, 15 de Marzo de 2006 07:22 p.m.
> Para: mysql@stripped
> Asunto: Error 1064: update .....select nested.
>
>
> Dear Sir,
>
> MySQL-4.1.12 on RedHat Linux EL4:
>
> mysql> update TABLE1 set FIELD1=(select FIELD2  from TABLE2 where
> mysql> COLUMN2=
> 'sales@stripped') where COLUMN1='sales@stripped';
>
> ERROR 1064: You have an error in your SQL syntax.  Check the manual that
> corresp onds to your MySQL server version for the right syntax to use
near
> 'select FIELD2 from TABLE2 where COLUMN2='sales@stripped
>
> mysql>
>
> For MySQL -5.0.18   is   Ok
>
> Syntax error for version 4.1.12 ?
>
> Thanks you and best regards,
> --
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>

Thread
Error 1064: update .....select nested.Truong Tan Son16 Mar
  • RE: Error 1064: update .....select nested.Ing. Edwin Cruz16 Mar
    • RE: Error 1064: update .....select nested.SGreen16 Mar
      • (SOLVED) Re: Error 1064: update .....select nested.Truong Tan Son17 Mar