以下说明主要为已注册版本后的数据存储
Arcgis SDE 中的存储为基表+A表-D表
基表为基本表,即原始表, 假设基表名为test
A表记录所有历史数据,命名为A(ID)表 ,如A22
D表记录删除的数据,命名为D(ID)表 ,如D22
基表和A 表,D表的关系,可以从注册表中查到 table_registry
select registration_ID from sde.table_registry
where table_name='test'
registration_ID就是对应的A表,D表的ID
基表的所有记录加上A表的在状态表中已完成的记录(即关联state_id字段,状态表states的closing_time字段不为空就是最终的结果,这样可以把中间的过程记录过滤掉)
再减去D表中的记录就可以了
示例:
select registration_ID from sde.table_registry
where table_name='test'
得到 registration_ID=22
要查所有的记录就可以用下列语句查询
select objectid,testfield from sde.a22 where
(sde_state_id not
in (select sde_state_id from sde.d22) )
and sde_state_id in( select state_id from sde.states
where length(closing_time)>0
)
union
select objectid,testfield from SDE.test