MySQL Trigger - update table with value selected from another table
问题 I'm having problems updating row in a table with value selected from another table in MySQL Trigger. My Trigger looks like this CREATE TRIGGER update_user_last_login AFTER INSERT or UPDATE ON last FOR EACH ROW BEGIN DECLARE _user_id INTEGER; SELECT user_id INTO _user_id FROM user_profile WHERE user_name = NEW.username; UPDATE user set last_login = NEW.seconds WHERE id = _user_id; END I'm getting error message: ERROR 1054 (42S22): Unknown column '_user_id' in 'where clause' Could somebody