I have these two table called "cases" and attendance respectively which has four columns:
cases- id empid reaction date_t 1 EMP12654 interested 2017-09-22 attendance- id empid logintime logouttime date_t flag workinghours call_att 1 EMP12654 00:14:49 05:14:49 2017-09-18 set 6 1 What I want to do is create a trigger on cases table that updates call_att column of attendance table with number of entries in reaction column of cases table, this is what I have tried so far
CREATE DEFINER=`root`@`localhost` TRIGGER `number_call` AFTER INSERT ON `cases` FOR EACH ROW BEGIN UPDATE attendance set call_att=call_att +1 WHERE empid=new.empid AND date_t=new.date_t; END But that doesn't seem to work. I am quite new to triggers.