[snip]
UPDATE table1
LEFT JOIN table2 ON table2.ID=table2.ID_table1
SET table2.value=table2.value-IF(table1.condition=7,1,0),
    table1.condition=8
WHERE table1.ID=$id

Is this behavior correct?
[/snip]

In the sense that it did what was given to it in the query, yes. From
http://www.mysql.com/update

"If you use a multiple-table UPDATE statement involving InnoDB tables
for which there are foreign key constraints, the MySQL optimizer might
process tables in an order that differs from that of their parent/child
relationship. In this case, the statement will fail and roll back.
Instead, update a single table and rely on the ON UPDATE capabilities
that InnoDB provides to cause the other tables to be modified
accordingly. "

If you are using MyISAM style tables you should never attempt multiple
table updates without triggers and/or stored procedures to update the
subsequent tables.

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

Reply via email to