CREATE DEFINER=`aerion`@`192.180.1.5` TRIGGER `comp_contact_after_insert` AFTER INSERT ON `comp_contact` FOR EACH ROW begin INSERT INTO log_global set last_update = now(), updater = (select concat(firstname,' ',lastname) as name from emp where emp_id=(case when (NEW.updated_by = 0) then 1 else NEW.updated_by end)), table_update = 'comp_contact', actions = 'A', table_id = CONCAT('comp_contact_id', '.',NEW.comp_contact_id), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=NEW.comp_id)), col4 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=NEW.emp_id)), col7 = CONCAT('title', '.',NEW.title), col10 = CONCAT('description', '.',NEW.description); END CREATE DEFINER=`jitenpatel`@`%` TRIGGER `comp_contact_after_update` AFTER UPDATE ON `comp_contact` FOR EACH ROW begin INSERT INTO log_global set last_update = now(), updater = (select concat(firstname,' ',lastname) as name from emp where emp_id=(case when (OLD.updated_by = 0) then 1 else OLD.updated_by end)), table_update = 'comp_contact', actions = 'O', table_id = CONCAT('comp_contact_id', '.',OLD.comp_contact_id), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=OLD.comp_id)), col4 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=OLD.emp_id)), col7 = CONCAT('title', '.',OLD.title), col10 = CONCAT('description', '.',OLD.description); INSERT INTO log_global set last_update = now(), updater = (select concat(firstname,' ',lastname) as name from emp where emp_id=(case when (NEW.updated_by = 0) then 1 else NEW.updated_by end)), table_update = 'comp_contact', actions = 'N', table_id = CONCAT('comp_contact_id', '.',NEW.comp_contact_id), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=NEW.comp_id)), col4 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=NEW.emp_id)), col7 = CONCAT('title', '.',NEW.title), col10 = CONCAT('description', '.',NEW.description); END CREATE DEFINER=`jitenpatel`@`%` TRIGGER `comp_contact_after_delete` AFTER DELETE ON `comp_contact` FOR EACH ROW begin INSERT INTO log_global set last_update = now(), updater = (select concat(firstname,' ',lastname) as name from emp where emp_id=(case when (OLD.updated_by = 0) then 1 else OLD.updated_by end)), table_update = 'comp_contact', actions = 'D', table_id = CONCAT('comp_contact_id', '.',OLD.comp_contact_id), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=OLD.comp_id)), col4 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=OLD.emp_id)), col7 = CONCAT('title', '.',OLD.title), col10 = CONCAT('description', '.',OLD.description); END