linux - Mysql Trigger - How to trigger on particular row only -


I have an imaginary table, the result is:

  Products | Price Applet 1 Orange 2 I'm trying to create a trigger that will be executed before the update, which will add only 2 for the price if the new value was for apple this trigger What do you look like Example execute someone  
  fruit set value = 2 where product = 'apple';   

The new value for apples will be 4.

I tried to trigger down but surely 2

  SEG set value = new.value + 2 ed    

Use some code like this in your trigger:

  if new.product = 'Apple 'Then set new.value = new.value + 2; end if;    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -