I have this procedure. It works but what i need is that instead of puntos = 5
, it adds +2
puntos to what is in the DB. How could I do it?
Example:
Procedure:
delimiter $$
create procedure select_or_insert()
begin
IF EXISTS (select * from result_equipo where id_eq = '27') THEN
update result_equipo set puntos = 5 where id_eq = '27';
ELSE
insert into result_equipo (id_reseq, id_div, jor, id_eq, puntos, pg,
pp, n_p, fecha) VALUES
(NULL, '25', '3', '27', '2', '1', '0', '0', '2018-05-05');
END IF;
end $$
delimiter ;
call select_or_insert();
I think you can modify the update statement like this -
update result_equipo set puntos = puntos+2 where id_eq = '27';