SQL 不同表结构的两张表A和B,往表中新增表B的数据,判断条件如果表A中不存在B中的记录

insert into A(no,name,status)values
(
    select no,name,'Add' from B where B.no not in
    (select no from A)
)

A(no,name,status)
B(no,name)
no是主键,上面这么写报错,请问要怎么改 ?

 insert into A(no,name,status) 
    select no,name,'Add' from B where B.no not in
    (select no from A)

括号是把单个的数值变成表。你的Select出来已经是表了,就不用括号了

一楼的是正解,不要用括号和values了。