Mysql update in报错 解决方案:

   [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause

  意思是不能在同一语句中更新select出的同一张表元组的属性值

  解决方法:将select出的结果通过中间表再select一遍即可。

错误sql:

update company_info set email = 'ttt@163.com'
where  id in   (select t.id  from company_info t where t.id<3) 

修改后可执行的sql:

update company_info set email = 'ttt@163.com'
where  id in  (select a.id from (select t.id  from company_info t where t.id<3)a )

 

相关文章:

  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-07-01
  • 2021-11-07
  • 2022-01-12
  • 2021-05-20
  • 2021-10-24
猜你喜欢
  • 2022-12-23
  • 2022-01-19
  • 2021-06-28
  • 2022-01-08
  • 2022-12-23
  • 2021-06-20
  • 2021-08-23
相关资源
相似解决方案