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 table1 VALUES (2,8);
CREATE TABLE table2 (
ID int(10) unsigned NOT NULL default '0',
ID_table1 int(10) unsigned NOT NULL default '0',
value int(10) unsigned NOT NULL default '0'
) TYPE=InnoDB;
INSERT INTO table2 VALUES (1,1,5);
INSERT INTO table2 VALUES (2,2,2);
--
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.
MySQL: 4.0.20
Greetings
Kai
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]