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

insert 语句有关问题

2011-12-26 
insert 语句问题?usemy_oagoinsertintotb_AA(InfoId)selectInfoIdfromtb_BBwheretb_AA.ANametb_BB.BName

insert 语句问题?
use   my_oa
go
insert   into   tb_AA   (InfoId)  
select   InfoId  
from   tb_BB  
where   tb_AA.AName   =   tb_BB   .BName


插入表tb_AA时失败,错在哪里?该如何改呢?


[解决办法]
insert into tb_AA (InfoId) values(你的值)

[解决办法]
接分
[解决办法]
insert into tb_AA (A.InfoId)
select B.InfoId
from tb_BB B Left Join tb_AA A
On A.AName = B.BName

[解决办法]
use my_oa
go
insert into tb_AA (InfoId)
select tb_AA.InfoId
from tb_BB,tb_AA
where tb_AA.AName = tb_BB.BName


这样就可以了

[解决办法]
insert into tb_AA s(InfoId)
select InfoId
from tb_AA ,tb_BB
where tb_AA.AName = tb_BB .BName
[解决办法]
insert into tb_AA (A.InfoId)
select B.InfoId
from tb_BB B Left Join tb_AA A
On A.AName = B.BName
--------------------
正解
[解决办法]
insert into tb_AA (A.InfoId)
(select B.InfoId
from tb_BB B Left Join tb_AA A
On A.AName = B.BName)

[解决办法]
update 原理是一样的,可以用下面的语句


Update tb_AA set InfoId = B.InfoId
from tb_BB B Left Join tb_AA A
On A.AName = B.BName

热点排行