Can you provide us a test case (sample table definitions and sample data) ?
Shawn Green Database Administrator Unimin Corporation - Spruce Pine Kai Ruhnau <[EMAIL PROTECTED]> wrote on 12/28/2004 10:23:23 AM: > 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 match your ON condition. Again, that > > would mean that you have nothing to update which would cause no changes to > > table2 so it would appear that the IF() is always false. > > Hmm, I really should have read that query twice, sorry > > 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=$id > > Problem: table2.value is never changed, even if table1.condition > equals 7 before > the query. > > Greetings > Kai > > -- > 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] >