CREATE TABLE public.audit_logging ( id bigserial NOT NULL, functional_type varchar NULL, "content" varchar NULL, created_by varchar NULL, created_date timestamp NULL, CONSTRAINT audit_logging_pk PRIMARY KEY (id) ); ALTER TABLE public.consultant ADD latest_login_time timestamp NULL; update consultant set latest_login_time = (select login_date from login_record where account = 'A183619275' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'A183619275'; update consultant set latest_login_time = (select login_date from login_record where account = 'AGAM11249699' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'AGAM11249699'; update consultant set latest_login_time = (select login_date from login_record where account = 'Z152717443' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'Z152717443'; update consultant set latest_login_time = (select login_date from login_record where account = 'D265260662' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'D265260662'; update consultant set latest_login_time = (select login_date from login_record where account = 'AG0109051204' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'AG0109051204'; update consultant set latest_login_time = (select login_date from login_record where account = 'B282677963' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'B282677963'; update consultant set latest_login_time = (select login_date from login_record where account = 'AG0101234567' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'AG0101234567'; update consultant set latest_login_time = (select login_date from login_record where account = 'X147309614' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'X147309614'; update consultant set latest_login_time = (select login_date from login_record where account = 'J149388015' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'J149388015'; update consultant set latest_login_time = (select login_date from login_record where account = 'R221444250' and login_method = 'E_SERVICE' and result = 'SUCCESS' order by login_date desc limit 1) where agent_no = 'R221444250';