我有下表:
发明人( inventorID , PatentNo ,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字段为空,然后它不会插入发明人表
答案 0 :(得分: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;