CREATE DEFINER=`aerion`@`192.180.1.5` TRIGGER `comp_contact_no_after_insert` AFTER INSERT ON `comp_contact_no` 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_no', actions = 'A', table_id = CONCAT('comp_contact_no_id', '.',NEW.comp_contact_no_id ), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=(select comp_id from comp_contact where comp_contact_id=NEW.comp_contact_id))), col2 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=(select emp_id from emp_contact where emp_contact_id=NEW.emp_contact_id))), col4 = CONCAT('contact_detail', '.',(select contact_detail from contact_no where contact_id=(select contact_id from emp_contact where emp_contact_id=NEW.emp_contact_id))), col5 = CONCAT('contact_type', '.',(select look_values from look_values where look_values_id=(select emp_contact_type from emp_contact where emp_contact_id=NEW.emp_contact_id))), col7 = CONCAT('title', '.',(select title from comp_contact where comp_contact_id=NEW.comp_contact_id)), col10 = CONCAT('description', '.',(select description from comp_contact where comp_contact_id=NEW.comp_contact_id)), col13 = CONCAT('summary', '.',(select summary from emp_contact where emp_contact_id=NEW.emp_contact_id)); END CREATE DEFINER=`aerion`@`192.180.1.5` TRIGGER `comp_contact_no_after_update` AFTER UPDATE ON `comp_contact_no` 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_no', actions = 'O', table_id = CONCAT('comp_contact_no_id', '.',OLD.comp_contact_no_id ), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=(select comp_id from comp_contact where comp_contact_id=OLD.comp_contact_id))), col2 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=(select emp_id from emp_contact where emp_contact_id=OLD.emp_contact_id))), col4 = CONCAT('contact_detail', '.',(select contact_detail from contact_no where contact_id=(select contact_id from emp_contact where emp_contact_id=OLD.emp_contact_id))), col5 = CONCAT('contact_type', '.',(select look_values from look_values where look_values_id=(select emp_contact_type from emp_contact where emp_contact_id=OLD.emp_contact_id))), col7 = CONCAT('title', '.',(select title from comp_contact where comp_contact_id=OLD.comp_contact_id)), col10 = CONCAT('description', '.',(select description from comp_contact where comp_contact_id=OLD.comp_contact_id)), col13 = CONCAT('summary', '.',(select summary from emp_contact where emp_contact_id=OLD.emp_contact_id)); 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_no', actions = 'N', table_id = CONCAT('comp_contact_no_id', '.',NEW.comp_contact_no_id ), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=(select comp_id from comp_contact where comp_contact_id=NEW.comp_contact_id))), col2 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=(select emp_id from emp_contact where emp_contact_id=NEW.emp_contact_id))), col4 = CONCAT('contact_detail', '.',(select contact_detail from contact_no where contact_id=(select contact_id from emp_contact where emp_contact_id=NEW.emp_contact_id))), col5 = CONCAT('contact_type', '.',(select look_values from look_values where look_values_id=(select emp_contact_type from emp_contact where emp_contact_id=NEW.emp_contact_id))), col7 = CONCAT('title', '.',(select title from comp_contact where comp_contact_id=NEW.comp_contact_id)), col10 = CONCAT('description', '.',(select description from comp_contact where comp_contact_id=NEW.comp_contact_id)), col13 = CONCAT('summary', '.',(select summary from emp_contact where emp_contact_id=NEW.emp_contact_id)); END CREATE DEFINER=`aerion`@`192.180.1.5` TRIGGER `comp_contact_no_after_delete` AFTER DELETE ON `comp_contact_no` 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_no', actions = 'D', table_id = CONCAT('comp_contact_no_id', '.',OLD.comp_contact_no_id ), col1 = CONCAT('Comp_name', '.',(select companyname from company where comp_id=(select comp_id from comp_contact where comp_contact_id=OLD.comp_contact_id))), col2 = CONCAT('emp_name', '.',(select concat(firstname,' ',lastname) as name from emp where emp_id=(select emp_id from emp_contact where emp_contact_id=OLD.emp_contact_id))), col4 = CONCAT('contact_detail', '.',(select contact_detail from contact_no where contact_id=(select contact_id from emp_contact where emp_contact_id=OLD.emp_contact_id))), col5 = CONCAT('contact_type', '.',(select look_values from look_values where look_values_id=(select emp_contact_type from emp_contact where emp_contact_id=OLD.emp_contact_id))), col7 = CONCAT('title', '.',(select title from comp_contact where comp_contact_id=OLD.comp_contact_id)), col10 = CONCAT('description', '.',(select description from comp_contact where comp_contact_id=OLD.comp_contact_id)), col13 = CONCAT('summary', '.',(select summary from emp_contact where emp_contact_id=OLD.emp_contact_id)); END