be.
[snip]
Just in case, I filled bug report number #7590. Feel free to add your
comment.
Greetings
Kai
--
Kai Ruhnau
Software
t a r g e t
systemelectronic gmbh
kölner str. 99
42651 Solingen
germany
Tel: +49 (0)212 22 20 9 - 710
Fax: +49 (0)212 20 10 45
--
MySQL General Mailing List
For list
--
Kai Ruhnau
Software
t a r g e t
systemelectronic gmbh
kölner str. 99
42651 Solingen
germany
Tel: +49 (0)212 22 20 9 - 710
Fax: +49 (0)212 20 10 45
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Zitat von Jay Blanchard [EMAIL PROTECTED]:
[snip]
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),
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
Sorry for duplicating this message. But I sent the other one with the wrong
subject.
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),
Zitat von [EMAIL PROTECTED]:
One reason may be due to your ON condition.
ON table2.ID=table2.ID_table1
You reference table 2 twice and I doubt that on the table2 table id equals
id_table1 very often. Because table2 is LEFT JOINed to table1, you will
only be able to update the rows that
Zitat von [EMAIL PROTECTED]:
Can you provide us a test case (sample table definitions and sample data)
?
Sure.
--
CREATE TABLE table1 (
ID int(10) unsigned NOT NULL default '0',
condition int(10) unsigned NOT NULL default '0'
) TYPE=InnoDB;
INSERT INTO table1 VALUES (1,7);
INSERT INTO
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
).
No rows, because no row is actually returned / selected.
Thanks and greetings,
Kai Ruhnau
--
This signature is left as an exercise for the reader.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]