gpt4 book ai didi

带子查询的 MySql 更新语句

转载 作者:行者123 更新时间:2023-11-29 12:53:17 25 4
gpt4 key购买 nike

请看一下我在 MySql Workbench 中写的这条语句:

update customer set flag = 1
where id in (select id from customer
group by phoneNumber
having count(phoneNumber) > 1);

显示以下消息:

Error Code: 1093. You can't specify target table 'customer' for update in FROM clause

我做错了什么?

最佳答案

尝试一下:

  update customer set flag = 1
where id in (select * from (select id from customer
group by phoneNumber
having count(phoneNumber) > 1)t ) ;

关于带子查询的 MySql 更新语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24436549/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com