Hi,

An SQL-statement that is conceptually equal to the following caused some astonishment.

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

My problem is the IF condition, which alway evaluates to false no matter what conditions value was before the query. My explanation is, that MySQL first updates table1 and uses the changed values to update table2.

In the meantime I solved it on application-level, but up to now I consindered a multi table update an atomic operation.

Is this behavior correct?

Greetings
Kai

--
This signature is left as an exercise for the reader.
Unsatz des Jahres:
$POLITIKER ruft $PARTEI zur Geschlossenheit.


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



Reply via email to