insert into + select from 同一张表 的问题

yhgfriend 2018-10-25 05:17:47
insert into metergroup set SensorNo=3042, Parent=(select No from metergroup where GroupName='198_20181025_120442' limit 1)
会提示错误:#1093 - You can't specify target table 'metergroup' for update in FROM clause
就是同一张表用 insert 与 select from 会出错,请问正确的应该怎么写
...全文
1045 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjcxc 2018-10-26
  • 打赏
  • 举报
回复
insert into metergroup set SensorNo=3042, Parent=(
select * from(select No from metergroup where GroupName='198_20181025_120442' limit 1) a )

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧