-- If the session has ended remove the related database entries IF NEW.acctstoptime IS NOT NULL THEN UPDATE usage_session SET completed = NOW() WHERE acctuniqueid = NEW.acctuniqueid; DELETE FROM disconnect WHERE acctuniqueid = NEW.acctuniqueid; END IF;