insert into users(email, is_CM, password, username)
values ('[email protected]','N','*****','sidd@12345')
ON DUPLICATE KEY UPDATE username=(SELECT username FROM users WHERE username = VALUES(username) OR email= VALUES(email));
我正在尝试运行此查询,但出现错误错误1093(HY000):您无法在FROM子句中指定目标表“用户”进行更新
请帮助我
那里通常不使用子查询。我希望:
insert into users (email, is_CM, password, username)
values ('[email protected]', 'N', '*****',' sidd@12345')
on duplicate key update username = values(username), email = values(email));
这将现有行设置为传递给查询的值。