STIBS,
Thursday, October 17, 2002, 12:26:34 AM, you wrote:

S> I have a littlebig problem:

S> I want to UPDATE table1.fields with data from table2.fields WHERE the id (in this
S> case a product number) is the same in both tables.

S> OK, I did this:

S> UPDATE table1 SET table1.field1 = table2.field1, table1.field2 = table2.field2,...
S> WHERE table1.id = table2.id;

S> The answer from MySQL is: Unknown table 'table2' in WHERE clause .

S> Heading to MySQL.com the docs tell me nothing than there is a INSERT ... SELECT.

S> In my case this would be an UPDATE ... SELECT coz I don't want a new table, just
S> updating records of an existing with data from another.

S> I'm sure I just miss the right topic to look at. Point me please.

S> Second try: 

S> I used 

S> UPDATE table1, table2 SET table1.field1 = table2.field1, table1.field2 = 
table2.field2,...
S> WHERE table1.id = table2.id;

S> It still gives me an error, now  in the SQL Syntax when I set the table1.field2 
value. It doesn't find the second tables name [You have an error... near ... 
table(2.field2 should be here)].

What version do you use? Multi-tables updates are supported only since
4.0.2



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ma02-010c
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to