Answer the question
In order to leave comments, you need to log in
How to use "Case when" in "after update" trigger?
I have an "update" trigger that looks like this:
CREATE DEFINER=`root`@`localhost` TRIGGER `Removal_add` BEFORE UPDATE ON `post_cost` FOR EACH ROW BEGIN
set new.Removal_pl = ((CASE WHEN (select `Poli_csl` from slid where slid.id = new.id)<10 then
(select `Model_R_Hr` from rate where rate.id = new.id) *
(select `Time_hr` from rate where rate.id = new.id) * 0.3
else (select `Model_R_Hr` from rate where rate.id = new.id) *
(select `Time_hr` from rate where rate.id = new.id) END));
END
CREATE TRIGGER post_2
AFTER UPDATE
ON slid FOR EACH ROW
BEGIN
UPDATE `harld`.`post_cost` set `Removal_pl` = CASE WHEN new.`Poli_csl` where `id` = new.id < 10 then
(select `Model_R_Hr` from rate where rate.id = new.id) *
(select `Time_hr` from rate where rate.id = new.id) * 0.3
else (select `Model_R_Hr` from rate where rate.id = new.id) *
(select `Time_hr` from rate where rate.id = new.id) END));
END;
Answer the question
In order to leave comments, you need to log in
vue.js is a cool thing. Try it. Like Angular, but a little lighter and faster. There are more stars on the gita, although younger))
If for myself for the future, with the prospect of working with him in a year or two, then of course the second.
If tomorrow, in a month to work, in a project with angular, then there is most likely the first version. Therefore, it is necessary to learn first.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question