Re: update and control flow

2014-12-09 Thread hsv
2014/12/09 14:25 +, Martin Mueller I'm trying to get my feet wet with 'if' and 'when' uses in mysql. it would be very useful for update operations, but I can't get it right. If I read the documentation correctly, it should be possible to say something like UPDATE X if WORD like '

Re: update and control flow

2014-12-09 Thread shawn l.green
Hello Martin, On 12/9/2014 9:25 AM, Martin Mueller wrote: I'm trying to get my feet wet with 'if' and 'when' uses in mysql. it would be very useful for update operations, but I can't get it right. If I read the documentation correctly, it should be possible to say something like UPDATE X if W

Re: update and control flow

2014-12-09 Thread Michael Dykman
​You can use your login inline with nested IF expressions: insert into foo(id,comment) values(17, IF(WORD like 'a%','a',IF(word like 'b%','b',null)));​ On Tue, Dec 9, 2014 at 9:50 AM, wagnerbianchi.com wrote: > You can do that, but, perhaps the only chance to have it updating a row > bas

Re: update and control flow

2014-12-09 Thread wagnerbianchi.com
You can do that, but, perhaps the only chance to have it updating a row based on a condition is developing a Stored Procedure or even having a BEFORE Trigger associated with the main table. Those ways, you can test the sent value and decide on what UPDATE you will execute afterwards. Consider that