Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
SQL OOH Point In Time Race
clancyjane edited this page Sep 23, 2014
·
2 revisions
-- this is the table all point in time measures come fromselect cd_race_census ,count(distinct id_prsn_child) fromprtl.ooh_point_in_time_childwhere point_in_time_date='2011-01-01'and date_type=2and qry_type=2group by cd_race_census
order by cd_race_census
-- this is CA tableselectrp.cd_race_census,count(distinct plc.child) frombase.rptPlacement_Events plc
joinbase.rptPlacement rp onrp.id_removal_episode_fact=plc.id_removal_episode_factjoin ref_last_dw_transfer dw ondw.cutoff_date=dw.cutoff_datewhererp.removal_dt<'2011-01-01'and iif( rp.[18bday] <rp.discharge_dtandrp.discharge_dt<=cutoff_date,rp.[18bday],rp.discharge_dt)>='2011-01-01'andplc.begin_date<='2011-01-01'andplc.end_date>='2011-01-01'and not exists (select*from vw_nondcfs_combine_adjacent_segments nd wherend.id_prsn=rp.childandrp.removal_dt between nd.cust_beginandnd.cust_endandrp.discharge_dt between nd.cust_beginandnd.cust_end )
andrp.age_at_removal_mos<12*18andrp.age_at_removal_mos>=0group byrp.cd_race_censusThese do not match exactly as in the top table, the episodes are "spliced" removing the "nondcfs" segments.