0

我有下表:

发明人(inventorIDPatentNo、InventorFirst、InventorLast、City、State)

其中inventorid 是pk,patentno 是fk。

这是当前的插入代码:

insert into Inventor (PatentNo, InventorFirst, InventorLast, City, statename, country, NationalityCountry, ResidenceCountry)
select PatentNo, InventorFirstname, InventorLastname, City, statename, country, NationalityCountry, ResidenceCountry
from InventorUpdate;

我想修改它,以便如果 InventorFirstname 和 InventorLastname 字段为空,则它不会插入到发明者表中

4

1 回答 1

4

您如何保留那些字段为空的记录不被选中?

insert into Inventor (PatentNo, InventorFirst, InventorLast, City, statename, country, NationalityCountry, ResidenceCountry)
select PatentNo, InventorFirstname, InventorLastname, City, statename, country, NationalityCountry, ResidenceCountry
from InventorUpdate
Where InventorFirstname is not null 
And   InventorLastname is not null;
于 2012-07-20T00:30:12.213 回答