--根据另一张表修改表中的数据
update Admin_FCOutDt set oLastId=T.contractID from (select crm_contract.contractTopic,crm_contract.contractID from Admin_FCOutDt left join crm_contract on Admin_FCOutDt.ContractName=crm_contract.contractTopic )T where Admin_FCOutDt.ContractName=T.contractTopic --把查询另一张表 insert into Admin_FCOutDt(protype,number) select '测试',num from crm_contract --根据另一张表删除表中的数据 delete from Admin_FCOutDt where LastId in (select id from Admin_FCOut where prod like '%EF%') --两表合并查询(两个表之间的查询只列出这一个。会有单独的章节介绍) select fnumber ,fname from Admin_FCOutDt where state=1 union all select nub as fnumber,fname from crm_comtract
原文地址:http://blog.csdn.net/wyl900606/article/details/42454035