战地4怎么进行多人模式:如何时用SQL select命令 把一个库的某个字段的内容加入到另一个库里

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 20:20:59

可用:
use 要写入的数据库名
insert into 目标表 (字段名1,字段名2,……) (select 字段名1,字段名2,…… from 数据源库名..数据源表名 where 条件)
如果目标表内的字段与源表的中的字段不同可用以下命令格式:
第一步:select 字段名 as 目标字段名 into #临时表名 from 数据源库名..源表名 wehre 条件
第二步:update 目标表名 set 目标字段名=#临时表相同字段名 from #临时表名 a,目标表名 b where 条件
如:假设有A库和B库,要将A库A1表中的id字段的数据写入到B库B1表中的id字段。可用: 第一种
use B
insert into B1 (id) (select id from A..A1 where 条件)
第二种 B库B1表中的字段不是id,而是id2
use B
select id as id2 into #临时表名 from A..A1 where 条件
update B1 set b.id2=a.id2 from #临时表名 a,B1 b where 条件

update 表2
set 字段2=(select 字段1 from 表1 where .....)
where (.....)
select 字段1 from 表1 where ..... 选出要添加的字段的内容
where (.....) 选出要添加的位置