inner join sysobjects d on a.id=d.id and d.xtype='U' and d.name<>'dtproperties' where d.name='spkfk')
)as a1 ,
(select fdname from gzyry.dbo.fldlist where lower(fdname) in (select a.name from gzyry.sys.syscolumns a
inner join gzyry.sys.sysobjects d on a.id=d.id and d.xtype='U' and d.name<>'dtproperties' where d.name='goodsdoc')
)
as b1 where a1.fdname = b1.fdname
说明fldlist 表 是存放字段的表(自己定义) 可以直接将查询的字段存入
库:gzyry 和当前库
spkfk goodsdoc 为两张比较的表
SELECT a.date_3 - b.date_3 FROM tab1 a,tab2 b WHERE b.numb = a.numb前提是tab1和tab2都要有对应的numb
查数据字典select T.COLUMN_NAME
from ALL_TAB_COLUMNS T
where T.TABLE_NAME = 'A表'
minus
select T.COLUMN_NAME
from ALL_TAB_COLUMNS T
where T.TABLE_NAME = 'B表'
这样就找到了DBF_1比DBF_2多出来的列
要抽数据就直接写:
select 查到的几列 from DBF_1就行了
我给你的sql贴上去跑就行了啊,怎么还不清楚么?
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)