大概这样
程序代码:
Close Databases
Create Cursor t1 (id I, data1 C(10), data2 C(10))
Insert into t1 (id, data1, data2) Values (1, 'a', 'aaa')
Insert into t1 (id, data1, data2) Values (2, 'b', 'bbb')
Insert into t1 (id, data1, data2) Values (3, 'c', 'ccc')
Insert into t1 (id, data1, data2) Values (4, 'd', 'ddd')
Create Cursor t2 (id I, data1 C(10), data2 C(10))
Insert into t2 (id, data1, data2) Values (1, 'aa', 'aaa') && data1 不同
Insert into t2 (id, data1, data2) Values (2, 'b', 'bbb')
Insert into t2 (id, data1, data2) Values (3, 'c', 'ccccc') && data2 不同
Insert into t2 (id, data1, data2) Values (5, 'e', 'eee') && 新增记录
*-- 提取 t2 中与 t1 不同的记录(不包括 t2 新增的)
Select t2.* from t2 where exists ( ;
Select a.* from ( ;
Select id, Cast(Sys(2017,'',-1,1) as C(10)) as crc from t2) a ;
inner join ( ;
Select id, Cast(Sys(2017,'',-1,1) as C(10)) as crc from t1) b on a.id = b.id ;
where a.id = t2.id and a.crc != b.crc ;
)