At 11:25 +1000 4/28/04, Nik Belajcic wrote:
Hello,

I just subscribed to the list (after a few years of absence) and have a
rather basic question -

I have two tables table1 and table2:

table1 - primarykey1, foreignkey, somevalue
table2 - primarykey2, somevalue

Both tables are populated with records, but foreignkey in table1 has no
value.

I want to copy primarykey2 from table2 into foreignkey in table1 for
records where table1.somevalue=table2.somevalue

If my understanding is correct, this should be straightforward with v4.1
where multitable UPDATE is supported, but since I am using 3.23.52 I

No. UPDATE is for modifying existing records. It sounds like you want to insert new records (they're not new in the source table, but new in the destination table).

think a different approach is required. If anyone can suggest a
workaround, I would greatly appreciate it as I am not really an expert
in this area.

Probably you want to use INSERT INTO ... SELECT FROM ...


http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

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



Reply via email to