VFP数据库中表2字段值替换相应表1字段值,且两表有相同字段。谢谢!

来源:百度知道 编辑:UC知道 时间:2024/06/24 09:19:04
表1 字段:ID(唯一)、DATE ,表2 字段:ID(不唯一)、DATE 各有两个字段.用表2的DATE字段值替换相应ID字段表1的DATE字段值,(表1字段ID值完全包含表2字段值ID内容)且不影响表1中没替换的DATE的值.
例如:表1 字段ID 001 002 003 004 字段DATE 2005 2005 2005 2005
表2 字段ID 002 002 003 003 字段DATE 2006 2006 2007 2007
经过替换后 表1 字段ID 001 002 003 004 字段DATE 2005 2006 2007 2005
而不是像 表1 字段ID 001 002 003 004 字段DATE 空 2006 2007 空
本人是初学者可不可写详些,谢谢!!!
set relation to id into 表2 我在运行的时到这一句出了错“表没有设计排序索引”,是怎么回事呀,谢谢!

use 表1
use 表2 order id in 0
set relation to id into 表2
repl all 表1.date with 表2.date

[注]表2必须有索引文件(以id为键)
建索引的方法:
use 表2
index on id tag id

select 表1
index on id tag id
set order to id

select 表2
set relation to id into 表2

repl all 表1.date with 表2.date