Insert into a (a1,a2,a3) values (1,select num from b where id=1,3) 这样select语句出现在赋值语句中是不允许的。
可以这样:
insert into a (a1,a2,a3) select 1,num,3 from b where id=1 即可解决
本文介绍了一种不正确的SQL插入语句用法,并提供了解决方案。错误的语句尝试在一个值的赋值部分使用SELECT子句,正确的做法是将SELECT语句放在整个INSERT语句中。
Insert into a (a1,a2,a3) values (1,select num from b where id=1,3) 这样select语句出现在赋值语句中是不允许的。
可以这样:
insert into a (a1,a2,a3) select 1,num,3 from b where id=1 即可解决
1311
8368

被折叠的 条评论
为什么被折叠?