Reporting to compare BC Reg and OrgBook databases
ianco opened this issue · comments
Compare databases to verify OrgBook is an accurate representation of BC Reg.
summary counts of active and historical corps by type (based on current state)
select corp.corp_typ_cd,
op_state.op_state_typ_cd,
count(*)
from bc_registries.corporation corp,
bc_registries.corp_state state,
bc_registries.corp_op_state op_state,
bc_registries.corp_type ctype
where state.corp_num = corp.corp_num
and state.end_event_id is null
and op_state.state_typ_cd = state.state_typ_cd
and corp.corp_typ_cd = ctype.corp_typ_cd
group by corp.corp_typ_cd, op_state.op_state_typ_cd;
detail listing of the above, based on current state
select corp.corp_num, corp.recognition_dts, corp.corp_typ_cd corp_typ_cd,
ctype.corp_class, ctype.short_desc,
state.state_typ_cd, op_state.op_state_typ_cd op_state_typ_cd
from bc_registries.corporation corp,
bc_registries.corp_state state,
bc_registries.corp_op_state op_state,
bc_registries.corp_type ctype
where state.corp_num = corp.corp_num
and state.end_event_id is null
and op_state.state_typ_cd = state.state_typ_cd
and corp.corp_typ_cd = ctype.corp_typ_cd;