读书人

老是提示select附近有语法异常小弟我

发布时间: 2013-11-23 10:52:51 作者: rapoo

老是提示select附近有语法错误,我没检查出来,帮我看看吧?谢谢!
string MyInsert = "insert into QQqun1 (QQ) values (select Distinct(QQ) from QQqun2 a where not exists ( select QQ from QQqun1 b where a.QQ=b.QQ) )";
老是提示select附近有语法错误,我没检查出来,帮我看看吧?谢谢!
[解决办法]
insert into QQqun1 (QQ) select qq from
[解决办法]


insert into QQqun1 (QQ) values (select Distinct(QQ) from QQqun2 a where not exists ( select QQ from QQqun1 b where a.QQ=b.QQ) )
改为:
insert into QQqun1 (QQ) select Distinct(QQ) from QQqun2 a where not exists ( select QQ from QQqun1 b where a.QQ=b.QQ)


自己看看有什么区别?
[解决办法]
引用:
string MyInsert = "insert into QQqun1 (QQ) values (select Distinct(QQ) from QQqun2 a where not exists ( select QQ from QQqun1 b where a.QQ=b.QQ) )";
老是提示select附近有语法错误,我没检查出来,帮我看看吧?谢谢!


你那样insert语句是一条一条插入的,但是你的values 那个QQ有多条数据,所以不能那样写
 string MyInsert = "insert into QQqun1 (QQ)  select Distinct(QQ) from QQqun2 a where  not  exists ( select QQ from QQqun1 b where a.QQ=b.QQ)"

读书人网 >C#

热点推荐