首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

一个数据库表向另一个数据库表安插数据

2012-06-20 
一个数据库表向另一个数据库表插入数据Java codeA表pscodeeffectdateterminationdate12 3B表pscodeeffectd

一个数据库表向另一个数据库表插入数据

Java code
A表pscode    effectdate    terminationdate  1        2 3         B表pscode    effectdate    terminationdate  1         2011-01-01     2012-01-122         2009-10-22     2012-06-103         2007-02-02     2011-11-054         2010-02-03     2010-10-115         2009-09-09     2012-01-05请问我怎么把B表里的effectdate字段和terminationdate字段插入到A表中,不等于A表中pscode的不插入进来


[解决办法]
SQL code
update A    set  effectdate=B.effectdate         ,terminationdate=B.terminationdate     from B where A.pscode=B.pscode
[解决办法]
SQL code
update a set a.effectdate=b.effectdate,a.terminationdate=b.terminationdatefrom bwhere a.pscode=b.pscode 

热点排行