当前位置: 代码迷 >> VFP >> 怎么将查询结果生成一个结构相同的表
  详细解决方案

怎么将查询结果生成一个结构相同的表

热度:4978   发布时间:2013-02-26 00:00:00.0
如何将查询结果生成一个结构相同的表
我有两个DBF文件zhitag和zhitag2,结构一样,字段名tagname,现在想查找zhitag2中有但在和zhitag没有的tagname,并将查询到的结果生成一个新的表,并且表的结构和原来两个表的结构一样,原来的表有很多个字段名

------解决方案--------------------------------------------------------
&&这次生成3个表,需要那个用哪个,呵呵
&&newdbf0------zhitag有 zhitag2有
&&newdbf1------zhitag有 zhitag2无
&&newdbf2------zhitag无 zhitag2有
close all
set talk off
clear
select 1
use zhitag2
recall all
? "zhitag2 "
list
go top
select 2
use zhitag
? "zhitag "
recall all
list
go top
select 1
do while .not. eof()
aa=tagname
select 2
locate for tagname=aa
if found()
delete
endif
select 1
skip
enddo
select 2
copy to newdbf0 for delete()
copy to newdbf1 for .not. delete()
recall all
use newdbf0
recall all
list
use newdbf1
recall all
list

close all
select 1
use zhitag
recall all
go top
select 2
use zhitag2
recall all
go top
select 1
do while .not. eof()
aa=tagname
select 2
locate for tagname=aa
if found()
delete
endif
select 1
skip
enddo
select 2

copy to newdbf2 for .not. delete()
recall all
use newdbf2
recall all
list
close all
  相关解决方案