首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

老是提示select附近有语法异常,小弟我没检查出来,帮小弟我看看吧?多谢

2013-11-23 
老是提示select附近有语法错误,我没检查出来,帮我看看吧?谢谢! string MyInsert insert into QQqun1 (Q

老是提示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)"

热点排行