今天介绍一下Mysql中不能update自身的解决方法:
问题:
无法执行:
update bi_data.order_all_detailset err_msg='同时存在于wx,zfb平台',proc_time=now()where order_no in(select order_nofrom bi_data.order_all_detailgroup by order_nohaving count(distinct platform)>1)
提示:1093 – You can’t specify target table ‘order_all_detail’ for update in FROM clause
解决方法 :
再加一层子查询:
update bi_data.order_all_detailset err_msg='同时存在于wx,zfb平台',proc_time=now()where order_no in(select order_nofrom(select order_nofrom bi_data.order_all_detailgroup by order_nohaving count(distinct platform)>1) tt)以上就是关于“ Mysql中不能update自身的解决方法”的相关解答,若有不清楚的可以咨询 酷番云 , 酷番云 作为云南为数不错持有ICP/ISP/IDC等资质专业云计算提供商之一,成本控制良好,性价比高!提供各类云服务器产品及ICP备案一站式服务,操作简单快捷,7*24小时不间断售后运维技术支持,专业备案团队全力支持。产品购买地址:














发表评论