Funny you should ask that.  There was a similar questoin answer on the PH-DB
mailing list (different poster, though)
Answer is:

REPLACE INTO test2 (test2.ID, test2.Value)
        SELECT test1.ID, test1.Value FROM test1 WHERE test1.ID LIKE '1'

>From manual:
"...REPLACE works exactly like INSERT, except that if an old record in
the table has the same
value as a new record on a unique index, the old record is deleted
before the new record is
inserted...."

-----Original Message-----
From: Moshe Gurvich [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 4:09 AM
To: [EMAIL PROTECTED]
Subject: UPDATE table1 FROM table2


In MySQL 3.23, how to update one table using information from another table.

update table1 set value1=t2.value2
from table1 as t inner join table2 as t1 using(pk_key) ???

or

update table1 as t1 inner join table2 as t2 using(pk_key)
set t1.value1=t2.value2 ???

Is it possible at all?

Thank you
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.281 / Virus Database: 149 - Release Date: 9/18/2001



---------------------------------------------------------------------
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



---------------------------------------------------------------------
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