[nycphp-talk] mySQL: update table from another table
Tim Gales
tgales at tgaconnect.com
Thu Oct 30 12:52:18 EST 2003
Brian,
Here's an excerpt from the MySQL Manual 3.22
" * Updates and deletes that run over multiple tables is
harder to do
in MySQL. This will, however, be fixed in MySQL 4.0
with multi-table
`DELETE' and multi-table `UPDATE' and in MySQL 4.1 with
subselects. "
And:
============================
`UPDATE' Syntax
---------------
UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
SET col_name1=expr1, [col_name2=expr2, ...]
[WHERE where_definition]
[LIMIT #]
`UPDATE' updates columns in existing table rows with new
values. The `SET' clause indicates which columns to modify
and the values they should be given. The `WHERE' clause, if
given, specifies which rows should be updated. Otherwise
all rows are updated...
================================
Hope this sheds some light on your situation
T. Gales & Associates
Helping People Connect with Technology
http://www.tgaconnect.com
-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org] On Behalf Of Brian
Pang
Sent: Thursday, October 30, 2003 11:36 AM
To: talk at lists.nyphp.org
Subject: [nycphp-talk] mySQL: update table from another table
I need to update table2 with data from table1
the mysql4 code would be:
update table2,table1 set table2.field = table1.field where
table2.id = table1.id
how is this done in mysql 3.x ?
More information about the talk
mailing list