crazytimor
crazytimor
2017-08-03 05:53

msyql 触发器语法问题 ,下面语法报错了,问题出在if语句上

  • select
  • mysql
  • 触发器
create trigger i_daily
before insert on  Daily_record
for each row begin
 select 
cooperation_mode_id,income_ratio into @cooperation_mode_id,@income_ratio
from 
Promotion_package where promotion_package_id=new.promotion_package_id;
end

if @cooperation_mode_id = 1 then
    set new.income=new.pay_all*@income_ratio;
elseif @cooperation_mode_id = 2 then
    set new.income=new.added_number*@income_ratio;
end if;
end

想问问到大佬们怎么改这个语法

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐