Re: Update on condition

2004-08-10 Thread Michael Stassen
And note that assignments are evaluated left to right, so the value of bounce_count has already been incremented when we get to the status assignment. Adjust accordingly. Michael Michael Stassen wrote: How about UPDATE table SET bounce_count = bounce_count+1, status = if(bounce_count

Re: Update on condition

2004-08-10 Thread Michael Stassen
How about UPDATE table SET bounce_count = bounce_count+1, status = if(bounce_count > 9, 'bounced_out', status) WHERE ...; Michael Scott Haneda wrote: I need to do a certain update based on a condition: MySql4 Update table set bounce_count = bounce_count+1 is the basic query, somewhere i

RE: Update on condition

2004-08-10 Thread Lachlan Mulcahy
Scott, This may work for you: UPDATE tableName SET bounce_count = bounce_count +1, status = 'bounced_out' WHERE (bounce_count + 1) > 10; UPDATE tableName SET bounce_count = bounce_count + 1 WHERE status <> 'bounced_out' AND (bounce_