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

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

Note that you put table1 first in your query above, so table 1 will get
updated first. Since that is the case the conditions for updating table2
are never met.

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

Reply via email to