【问题标题】:Update date +2 mysql更新日期+2 mysql
【发布时间】:2019-02-21 13:50:54
【问题描述】:

我有这个程序。它有效,但我需要的是,而不是puntos = 5,它将+2 puntos 添加到数据库中的内容中。我该怎么办?

例子:

Photo example

程序:

    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();

【问题讨论】:

    标签: mysql stored-procedures procedure


    【解决方案1】:

    我认为你可以像这样修改更新语句 -

    update result_equipo set puntos = puntos+2 where id_eq = '27';
    

    【讨论】:

      猜你喜欢
      • 2023-03-24
      • 1970-01-01
      • 2017-01-29
      • 2022-10-02
      • 1970-01-01
      • 2013-01-28
      • 2011-04-21
      • 2017-11-15
      • 1970-01-01
      相关资源
      最近更新 更多