Zitat von Jay Blanchard

> [snip]
> And the query:
>
> UPDATE table1
> INNER JOIN table2 ON table2.ID_table1=table1.ID
> SET table2.value=table2.value-IF(table1.condition=7,1,0),
>     table1.condition=8
> WHERE table1.ID IN (1,2)
>
> After that the value's in table2 are still 5 and 2. But I would expect
> the 5 to
> be a 4.
> [/snip]
>
> It was concerning the warning I sent about InnoDB and the order of
> precedence.....the query to solve the problem is here....

My reading of the mentioned paragraph is another:
It only describes the case when foreign key constraints may temporably be broken
during a multi table update, so that the InnoDB engine does not perform the
query.

Although my question goes in that direction, it is more about why this statement
does not act atomically from my applications point of view.

> update table2, table1
> SET table2.value=table2.value-IF(table1.condition=7,1,0),
> table1.condition=8
> WHERE table1.ID = table2.ID_table1

I wonder if a subselect can help here, too.

Gretins
Kai

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

Reply via email to