UPDATE with INNER JOIN?
am 13.12.2007 03:50:15 von Ron Piggott
Is it possible to do an UPDATE with an INNER JOIN --- I want the WHERE
to use 2 tables in selecting which rows are going to be updated in
table1.
Could you provide me with a simple example if this is possible using the
following variables:
table1 table2 table1.field1 table1.field2 table2.field1
Thanks
Ron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: UPDATE with INNER JOIN?
am 13.12.2007 04:31:11 von dmagick
Ron Piggott wrote:
> Is it possible to do an UPDATE with an INNER JOIN --- I want the WHERE
> to use 2 tables in selecting which rows are going to be updated in
> table1.
http://dev.mysql.com/doc/refman/5.0/en/update.html
You can also perform UPDATE operations covering multiple tables.
However, you cannot use ORDER BY or LIMIT with a multiple-table UPDATE.
The table_references clause lists the tables involved in the join. Its
syntax is described in Section 11.2.7.1, JOIN Syntax. Here is an example:
UPDATE items,month SET items.price=month.price
WHERE items.id=month.id;
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php